#include <SPI.h>
const uint32_t CS_PIN = D10; // à adapter à votre cablage
const uint16_t DIG0 = 0x01; // ligne 0
void setup() {
SPISettings cfgSPI(10000000, MSBFIRST, SPI_MODE0);
uint16_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
uint8_t data = 0x55;
SPI.beginTransaction(cfgSPI);
for (uint8_t idx = 0; idx < 8; idx++) {
trame = (DIG0 + idx) << 8;
data ^= 0x11;
trame |= data;
digitalWrite(CS_PIN, LOW);
SPI.transfer(trame);
SPI.transfer(trame);
SPI.transfer(trame);
SPI.transfer(trame);
digitalWrite(CS_PIN, HIGH); // le front montant provoque le verrouillage des données dans
}
SPI.endTransaction();
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}