Hi all,
I'm trying to write SPI control codes as following. My IC only wants to read 26 bits, which means only 0x20, 0x0C, 0x00, and B11 are needed. But as written, Arduino broad will output B00000011(8 bits) instead of B11(2 bits) only (the five upper bits B00000 are not wanted). How can I output only 26 bits? Thanks!
#include <SPI.h>
uint8_t g_Buffer2[]={0x20, 0x0C, 0x00, B11}; //0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1
void setup()
{
// setup SPI
Serial.begin(9600);
SPI.begin();
//CLOCK data pin 13
SPI.setClockDivider(SPI_CLOCK_DIV8);
}
void loop()
{
//SS pin 10
digitalWrite(SS,LOW);
//MOSI data pin 11
for(int i=0; i< sizeof(g_Buffer2); i++)
SPI.transfer (g_Buffer2[i]);
//disable slave
digitalWrite(SS,HIGH);
}