#include <SPI.h>

// #define pin_miso 19
// #define pin_mosi 23
// #define pin_sck 18
#define pin_ce 5
#define pin_pl 13

void load_data_spi(uint8_t *data) {
  memset(data, 0xff, 1);

  digitalWrite(pin_pl, LOW);
  digitalWrite(pin_pl, HIGH);

  SPI.transfer(data, 1);
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32-C3!");

  pinMode(pin_pl, OUTPUT);
  pinMode(pin_ce, OUTPUT);

  digitalWrite(pin_pl, HIGH);
  digitalWrite(pin_ce, LOW);

  SPI.begin();
  // SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
}

void loop() {
  uint8_t data[1] = {};

  load_data_spi(data);

  Serial.println(data[0], BIN);
  delay(300); // this speeds up the simulation
}
74HC165