There's no way to send an odd (not multiple of 8) bits using the SPI API. The length argument is in bytes. There might be ways to hack around this, but they won't be as simple as what you're suggesting.
On Sun, Feb 19, 2017 at 3:35 PM, todd welch <[email protected]> wrote: > I need help using SPI. New to using the IOIO and have never used SPI. > > I need to send 25 bits and have no idea the correct way to do it since the > ioio spi api requires using a byte array. > I have tried a lot of different things currently this is what I have; > pretty sure it is way wrong: > > > SpiMaster spi = ioio_.openSpiMaster(35, 38, 39, 36, > SpiMaster.Rate.RATE_500K); > > // DATA TO SEND: 10001011 00000100 10100000 0 > buffer = new byte[4]; > buffer[0] = (byte)0b10001011; > buffer[1] = (byte)0b00000100; > buffer[2] = (byte)0b10100000; > buffer[3] = (byte)0b00000000; > > spi.writeRead(buffer, buffer.length, 25, null, 0); > > > What is the transaction length (third arg in writeRead)? Can I use it > specify the number of bits? > Do I send a single bit at a time and call writeRead to send each of the 25 > bits? If so can someone show me an example. > > -- > You received this message because you are subscribed to the Google Groups > "ioio-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/ioio-users. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "ioio-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/ioio-users. For more options, visit https://groups.google.com/d/optout.
