Skip to content

Commit eaa4de2

Browse files
committed
blink red after fw load, static green after start sampling
Signed-off-by: Martin <[email protected]>
1 parent 3a6a6d4 commit eaa4de2

File tree

6 files changed

+267
-261
lines changed

6 files changed

+267
-261
lines changed

PyHT6022/HantekFirmware/custom/build/firmware.ihx

Lines changed: 242 additions & 242 deletions
Large diffs are not rendered by default.

PyHT6022/HantekFirmware/custom/device.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
// change to support as many interfaces as you need
3737
BYTE altiface = 0; // alt interface
3838
extern volatile WORD ledcounter;
39+
extern volatile __bit GREEN;
3940
WORD samplerate;
4041
BYTE numchannels;
4142

@@ -159,6 +160,7 @@ void start_sampling()
159160
ledcounter = 1000;
160161
LED_RED = LED_OFF;
161162
LED_GREEN = LED_ON;
163+
GREEN = TRUE;
162164
}
163165

164166
extern __code BYTE highspd_dscr;
@@ -343,7 +345,7 @@ BOOL eeprom() {
343345
break;
344346
case 0x40:
345347
while ( len ) {
346-
BYTE cur_write, c;
348+
BYTE cur_write;
347349
// printf ( "Len More Bytes %d\n" , len );
348350
EP0BCL = 0; // allow pc transfer in
349351
while ( EP0CS & bmEPBUSY ) // wait
@@ -369,6 +371,7 @@ BOOL handle_vendorcommand(BYTE cmd) {
369371
// Set Red LED
370372
LED_RED = LED_ON;
371373
LED_GREEN = LED_OFF;
374+
GREEN = FALSE;
372375
ledcounter = 1000; // monoflop
373376
switch (cmd) {
374377
case 0xa2:

PyHT6022/HantekFirmware/custom/dscr.a51

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ ENDPOINT_TYPE_BULK=2
4343
ENDPOINT_TYPE_INT=3
4444

4545
.globl _dev_dscr, _dev_qual_dscr, _highspd_dscr, _fullspd_dscr, _dev_strings, _dev_strings_end
46-
.globl _bulk_packet, _iso_packet
46+
4747
; These need to be in code memory. If
4848
; they aren't you'll have to manully copy them somewhere
4949
; in code memory otherwise SUDPTRH:L don't work right
50+
5051
.area DSCR_AREA (CODE)
5152

5253
_dev_dscr:
@@ -97,27 +98,17 @@ highspd_dscr_end:
9798
.db DSCR_INTERFACE_TYPE
9899
.db 0 ; index
99100
.db 0 ; alt setting idx
100-
.db 2 ; n endpoints
101+
.db 1 ; n endpoints
101102
.db 0xff ; class
102103
.db 0
103104
.db 0
104105
.db 0 ; string index
105106

106-
; endpoint 2 out
107-
.db DSCR_ENDPOINT_LEN
108-
.db DSCR_ENDPOINT_TYPE
109-
.db 0x02 ; ep2 dir=out and address
110-
.db ENDPOINT_TYPE_BULK ; type
111-
.db 0x00 ; max packet LSB
112-
.db 0x02 ; max packet size=512 bytes
113-
.db 0x00 ; polling interval
114-
115107
; endpoint 6 in
116108
.db DSCR_ENDPOINT_LEN
117109
.db DSCR_ENDPOINT_TYPE
118110
.db 0x86 ; ep1 dir=in and address
119111
.db ENDPOINT_TYPE_BULK ; type
120-
_bulk_packet:
121112
.db 0x00 ; max packet LSB
122113
.db 0x02 ; max packet size=512 bytes
123114
.db 0x00 ; polling interval
@@ -138,7 +129,6 @@ _bulk_packet:
138129
.db DSCR_ENDPOINT_TYPE
139130
.db 0x82 ; ep1 dir=in and address
140131
.db ENDPOINT_TYPE_ISO ; type
141-
_iso_packet:
142132
.db 0x00 ; max packet LSB
143133
.db 0x14 ; max packet size=3*1024 bytes
144134
.db 0x01 ; polling interval

PyHT6022/HantekFirmware/custom/fw.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
#define printf(...)
3232
#endif
3333

34-
volatile WORD ledcounter = 0;
34+
volatile WORD ledcounter = 1000;
35+
volatile __bit GREEN = FALSE;
3536

3637
volatile __bit dosud=FALSE;
3738
volatile __bit dosuspend=FALSE;
@@ -78,6 +79,10 @@ void main() {
7879
OEC = 0xff;
7980
OEA = 0x80;
8081

82+
LED_RED = LED_ON;
83+
LED_GREEN = LED_OFF;
84+
GREEN = FALSE;
85+
8186
while(TRUE) {
8287

8388
main_loop();
@@ -150,12 +155,17 @@ void suspend_isr() __interrupt SUSPEND_ISR {
150155

151156
void timer2_isr() __interrupt TF2_ISR {
152157
CAL_OUT = !CAL_OUT;
153-
if (ledcounter) {
154-
if (--ledcounter == 0) {
155-
// clear LED
158+
if (--ledcounter == 0) {
159+
ledcounter = 1000;
160+
if ( GREEN ) {
161+
// toggle green LED, switch red off
162+
LED_GREEN = !LED_GREEN;
156163
LED_RED = LED_OFF;
164+
} else {
165+
LED_RED = !LED_RED;
157166
LED_GREEN = LED_OFF;
158167
}
168+
GREEN = FALSE;
159169
}
160170
TF2 = 0;
161171
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
134 125 134 125 134 125 134 127 135 128 135 129 135 129 135 129 132 125 132 125 132 125 132 126 132 127 132 128 132 128 132 128

examples/examples_libusb/get_calibration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@
1010
calibration = scope.get_calibration_values()
1111
scope.close_handle()
1212

13-
print( calibration )
13+
# print( calibration )
14+
for x in calibration:
15+
print( x, end=" " )

0 commit comments

Comments
 (0)