#include <SPI.h>
const uint32_t CS_PIN = D6; // à adapter à votre cablage
const uint8_t DIG0 = 0x01; // ligne 0
void setup() {
SPISettings cfgSPI(10000000, MSBFIRST, SPI_MODE0);
uint8_t trame;
Serial.begin(115200);
Serial.println("Boot");
pinMode(CS_PIN, OUTPUT);
// SPI Transaction: sends the contents of buffer, and overwrites it with the received data
for(int i = 0;i<8;i++){
digitalWrite(CS_PIN, LOW);
SPI.beginTransaction(cfgSPI);
trame = (DIG0+i) << 4;
trame |= 0x05;
SPI.transfer(0x01);
SPI.transfer(0x80<<i);
for(int j = 0;j<3;j++){
SPI.transfer(0x01);
SPI.transfer(0xFF>>i);
}
SPI.endTransaction();
digitalWrite(CS_PIN, HIGH); // le front montant provoque le verrouillage des données dans
}
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}