17 #INCLUDE ONCE "BBB/pruio.bi"
19 #INCLUDE ONCE "BBB/pruio_pins.bi"
21 #INCLUDE ONCE "fbgfx.bi"
31 ,
full = fb.GFX_FULLSCREEN
34 VAR p =
INSTR(
COMMAND,
"x") _
35 ,
w =
VALINT(
COMMAND) _
36 ,
h =
VALINT(
MID(
COMMAND,
p + 1))
37 IF p ANDALSO w ANDALSO h THEN
38 IF w <
S_W - 4
ANDALSO h <
S_H - 24
THEN full = fb.GFX_WINDOWED
42 PRINT "set resolution like 640x400"
48 IF 0 =
SCREENPTR THEN PRINT "no grafic available" :
END
54 ,
RGBA(255, 0, 0, 255) _
55 ,
RGBA( 0, 255, 0, 255) _
56 ,
RGBA( 0, 0, 255, 255) _
57 ,
RGBA(255, 255, 0, 255) _
58 ,
RGBA(255, 0, 255, 255) _
59 ,
RGBA( 0, 255, 255, 255) _
60 ,
RGBA(127, 127, 127, 255) _
67 IF .Errr
THEN ?"initialisation failed (" & *.Errr &
")" :
EXIT DO
70 IF .Gpio->config(
PIN, PRUIO_GPIO_IN_1)
THEN _
71 ?"failed setting trigger pin (" & *.Errr &
")" :
EXIT DO
73 IF .Adc->setStep(
STP, 4, 0, 0, 0)
THEN _
74 ?"failed setting trigger step (" & *.Errr &
")" :
EXIT DO
79 ,
mask = (1
SHL 5) + (1
SHL 8) _
82 ?"config failed (" & *.Errr &
")" :
EXIT DO
85 VAR trg1 = .Adc->mm_trg_pin(
PIN)
86 IF 0 =
trg1 THEN ?"trg1 spec failed (" & *.Errr &
")" :
EXIT DO
88 VAR trg2 = .Adc->mm_trg_ain(
STP, &h8000)
89 IF 0 =
trg2 THEN ?"trg2 spec failed (" & *.Errr &
")" :
EXIT DO
91 VAR trg3 = .Adc->mm_trg_pre(0, -&h8000,
samp SHR 1)
92 IF 0 =
trg3 THEN ?"trg3 spec failed (" & *.Errr &
")" :
EXIT DO
95 VAR lnr =
IIF(
S_H > 72,
S_H SHR 3 - 8, 1) _
96 ,
max = .Adc->Samples - .Adc->ChAz _
100 ,
bg =
RGB(250, 250, 250)
106 ?"Choose trigger type"
107 ?" 0 = no trigger (start immediately)"
108 ?" 1 = GPIO trigger (pin P8_07 low)"
109 ?" 2 = analog trigger, AIN-4 > 0.9 V"
110 ?" 3 = analog pre-trigger, any AIN < 0.9 V"
111 DO :
SLEEP 1000, 0 :
k =
ASC(
INKEY()) :
LOOP UNTIL k
114 SELECT CASE AS CONST k
115 CASE ASC(
"0") :
trg = 0 :
?"starting immediately ...";
116 CASE ASC(
"1") :
trg =
trg1 :
?"waiting for GPIO trigger (pin P8_07 low) ...";
117 CASE ASC(
"2") :
trg =
trg2 :
?"waiting for analog trigger (AIN-4 > 0.9 V) ...";
118 CIRCLE (0,
S_H SHR 1), 5,
RGB(200, 200, 200), , , 1, F
119 CASE ASC(
"3") :
trg =
trg3 :
?"waiting for analog pre-trigger (any AIN < 0.9 V) ..." ;
120 CIRCLE (
S_W SHR 1,
S_H SHR 1), 5,
RGB(200, 200, 200), , , 1, F
124 IF .mm_start(
trg)
THEN ?"mm_start failed (" & *.Errr &
")" :
CONTINUE DO
127 FOR c AS INTEGER = 0
TO .Adc->ChAz - 1
128 VAR i =
c + .Adc->ChAz _
130 LINE (0,
S_H -
CUINT(.Adc->Value[
c] *
scale)) _
133 i += .Adc->ChAz :
IF i >=
max THEN EXIT DO
140 IF .Errr
THEN ?"press any key to quit" :
SLEEP