Skip to content

Commit 315e998

Browse files
committed
IOIO: duino-1088AS.bas sample now working
1 parent 2c8dfe9 commit 315e998

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

ioio/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static int cmd_twimaster_writeread(var_s *self, int argc, slib_par_t *arg, var_s
268268
static int cmd_spimaster_write(var_s *self, int argc, slib_par_t *arg, var_s *retval) {
269269
int result = 0;
270270
if (argc != 2) {
271-
error(retval, "SpiMaster.write", 0);
271+
error(retval, "SpiMaster.write", 2);
272272
} else {
273273
int id = get_io_class_id(self, retval);
274274
if (id != -1) {

ioio/samples/duino-1088AS.bas

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
import ioio
22

3+
' mosi = master-in slave-out (miso is unused here)
34
const mosiPin = 2
45
const misoPin = 6
56
const csPin = 3
67
const clkPin = 4
78

8-
spi = ioio.openSpiMaster(misoPin, mosiPin, sckPin, csPin)
9-
cs = ioio.openDigitalOutput(csPin)
10-
9+
spi = ioio.openSpiMaster(misoPin, mosiPin, clkPin, csPin)
1110
ioio.waitForConnect(10)
1211

13-
rem true sets the initial state to high (deasserted)
14-
cs.write(true)
15-
1612
spi.write(0x09, 0x00) ' Decode mode: no decode for digits 0-7
17-
spi.write(0x0A, 0x07) ' Intensity: maximum intensity 0x0 -> 0x0F
13+
spi.write(0x0A, 0x01) ' Intensity: maximum intensity 0x0 -> 0x0F
1814
spi.write(0x0B, 0x07) ' Scan limit: all digits
1915
spi.write(0x0C, 0x01) ' Shutdown: normal operation
2016

2117
while 1
2218
for i = 1 to 8
23-
spi.write(0x55)
19+
spi.write(i, 0x35)
2420
next
2521
delay 1000
2622
wend

0 commit comments

Comments
 (0)