17 #include ONCE "BBB/pruio.bi"
18 #include ONCE "BBB/pruio_pins.bi"
19 #include ONCE "BBB/pruio_prussdrv.bi"
54 DIM AS CONST UInt32 PRUcode(...) = { _
68 VAR l = (
UBOUND(PRUcode) + 1) *
SIZEOF(PRUcode)
85 ?"initialisation failed (" & *
io->Errr &
")" :
EXIT DO
101 IF prussdrv_open(PRU_EVTOUT_0)
THEN _
102 ?"prussdrv_open failed" :
EXIT DO
106 ?"failed loading PRUSS instructions" :
EXIT DO
123 IF io->setPin(
io, P8_11, 6)
THEN _
124 ?"P8_11 configuration failed (" & *
io->Errr &
")" :
EXIT DO
130 IF io->Cap->config(P9_42, 2.)
THEN _
131 ?"failed setting input P9_42 (" & *
io->Errr &
")" :
EXIT DO
132 IF io->config(1, 0, 0, 0)
THEN _
133 ?"config failed (" & *
io->Errr &
")" :
EXIT DO
148 ?"instructions loaded, starting PRU-" &
pru_num
152 prussdrv_pru_wait_event(PRU_EVTOUT_0)
154 IF io->Cap->Value(P9_42, @
f, @
d)
THEN _
155 ?"failed reading input P9_42 (" & *
io->Errr &
")" :
EXIT DO
157 ?"--> Frequency: " & (
f * .000001) &
" MHz, Duty:" & (
d * 100) &
" %"
159 prussdrv_pru_clear_event(PRU_EVTOUT_0,
pru_intr)