mkfrey / u8g2-hal-esp-idf

U8g2 compatibility component for esp-idf on ESP32
Apache License 2.0
59 stars 27 forks source link

Missing clock source for spi_device_interface_config_t #11

Open MrMarshy opened 9 months ago

MrMarshy commented 9 months ago

I was failing to communicate over SPI using the example. I had to insert a parameter for 'clock_source' in file u8g2_esp32_hal.c

spi_device_interface_config_t dev_config;
      dev_config.address_bits = 0;
      dev_config.command_bits = 0;
      dev_config.dummy_bits = 0;
      dev_config.mode = 0;
      dev_config.duty_cycle_pos = 0;
      dev_config.cs_ena_posttrans = 0;
      dev_config.cs_ena_pretrans = 0;
      dev_config.clock_speed_hz = SPI_MASTER_FREQ_10M;
      dev_config.clock_source = SPI_CLK_SRC_DEFAULT;
      dev_config.spics_io_num = u8g2_esp32_hal.bus.spi.cs;
      dev_config.flags = 0;
      dev_config.queue_size = 200;
      dev_config.pre_cb = NULL;
      dev_config.post_cb = NULL;

I also updated the 'clock_speed_hz' value to give SPI Clock speed of 10MHz.

ESP-IDF v5.1.2