diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index c9b2bbaf84..754a881221 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -132,18 +132,6 @@ examples/peripherals/sigma_delta: disable: - if: SOC_SDM_SUPPORTED != 1 -examples/peripherals/spi_master/hd_eeprom: - disable: - - if: IDF_TARGET == "esp32c2" - temporary: true - reason: target esp32c2 is not supported yet - -examples/peripherals/spi_master/lcd: - enable: - - if: IDF_TARGET in ["esp32", "esp32c3", "esp32s2"] - temporary: true - reason: the other targets are not tested yet - examples/peripherals/spi_slave_hd/append_mode/slave: enable: - if: IDF_TARGET == "esp32s2" diff --git a/examples/peripherals/spi_master/hd_eeprom/README.md b/examples/peripherals/spi_master/hd_eeprom/README.md index f47af1a814..0e54e66443 100644 --- a/examples/peripherals/spi_master/hd_eeprom/README.md +++ b/examples/peripherals/spi_master/hd_eeprom/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C3 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | ## SPI master half duplex EEPROM example @@ -11,16 +11,16 @@ For different chip and host used, the connections may be different. -| | ESP32 | ESP32 | ESP32S2 | ESP32C3 | ESP32S3 | -| ---- | ----- | ----- | ------- | ------- | ------- | -| Host | SPI1 | HSPI | FSPI | SPI2 | SPI2 | -| VCC | 3.3V | 3.3V | 3.3V | 3.3V | 3.3V | -| GND | GND | GND | GND | GND | GND | -| DO | 7 | 18 | 37 | 2 | 13 | -| DI | 8 | 23 | 35 | 7 | 11 | -| SK | 6 | 19 | 36 | 6 | 12 | -| CS | 13 | 13 | 34 | 10 | 10 | -| ORG | GND | GND | GND | GND | GND | +| | ESP32 | ESP32 | ESP32S2 | ESP32C2 | ESP32C3 | ESP32S3 | +| ---- | ----- | ----- | ------- | ------- | ------- | ------- | +| Host | SPI1 | HSPI | SPI2 | SPI2 | SPI2 | SPI2 | +| VCC | 3.3V | 3.3V | 3.3V | 3.3V | 3.3V | 3.3V | +| GND | GND | GND | GND | GND | GND | GND | +| DO | 7 | 18 | 37 | 2 | 2 | 13 | +| DI | 8 | 23 | 35 | 7 | 7 | 11 | +| SK | 6 | 19 | 36 | 6 | 6 | 12 | +| CS | 13 | 13 | 34 | 10 | 10 | 10 | +| ORG | GND | GND | GND | GND | GND | GND | ### Notes diff --git a/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c b/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c index 13f5326c69..00c3f217d7 100644 --- a/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c +++ b/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c @@ -45,7 +45,7 @@ # define PIN_NUM_MOSI 35 # define PIN_NUM_CLK 36 # define PIN_NUM_CS 34 -#elif defined CONFIG_IDF_TARGET_ESP32C3 +#elif defined CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2 # define EEPROM_HOST SPI2_HOST # define PIN_NUM_MISO 2 diff --git a/examples/peripherals/spi_master/lcd/README.md b/examples/peripherals/spi_master/lcd/README.md index 00a7f163fe..789b499912 100644 --- a/examples/peripherals/spi_master/lcd/README.md +++ b/examples/peripherals/spi_master/lcd/README.md @@ -1,11 +1,11 @@ -| Supported Targets | ESP32 | ESP32-C3 | ESP32-S2 | -| ----------------- | ----- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | # SPI Host Driver Example (See the README.md file in the upper level 'examples' directory for more information about examples.) -This example aims to show how to use SPI Host driver API, like `spi_transaction_t` and spi_device_queue. +This example aims to show how to use SPI Host driver API, like `spi_transaction_t` and spi_device_queue. If you are looking for code to drive LCDs in general, rather than code that uses the SPI master, that may be a better example to look at as it uses ESP-IDFs built-in LCD support rather than doing all the low-level work itself, which can be found at `examples/peripherals/lcd/tjpgd/` diff --git a/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c b/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c index fba231f517..ce99311eba 100644 --- a/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c +++ b/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c @@ -40,18 +40,18 @@ #define PIN_NUM_DC 21 #define PIN_NUM_RST 18 #define PIN_NUM_BCKL 5 -#elif defined CONFIG_IDF_TARGET_ESP32S2 +#elif defined CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 #define LCD_HOST SPI2_HOST #define PIN_NUM_MISO 37 #define PIN_NUM_MOSI 35 #define PIN_NUM_CLK 36 -#define PIN_NUM_CS 34 +#define PIN_NUM_CS 45 #define PIN_NUM_DC 4 #define PIN_NUM_RST 5 #define PIN_NUM_BCKL 6 -#elif defined CONFIG_IDF_TARGET_ESP32C3 +#elif defined CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2 #define LCD_HOST SPI2_HOST #define PIN_NUM_MISO 2 @@ -258,9 +258,11 @@ void lcd_init(spi_device_handle_t spi) const lcd_init_cmd_t* lcd_init_cmds; //Initialize non-SPI GPIOs - gpio_set_direction(PIN_NUM_DC, GPIO_MODE_OUTPUT); - gpio_set_direction(PIN_NUM_RST, GPIO_MODE_OUTPUT); - gpio_set_direction(PIN_NUM_BCKL, GPIO_MODE_OUTPUT); + gpio_config_t io_conf = {}; + io_conf.pin_bit_mask = ((1ULL<