diff --git a/code/hello_world_01/main/spi.c b/code/hello_world_01/main/spi.c index 33a5a1f..dcaa76d 100644 --- a/code/hello_world_01/main/spi.c +++ b/code/hello_world_01/main/spi.c @@ -69,6 +69,16 @@ void spi_init() */ esp_err_t epd_spi_send_sync_fullduplex(const uint8_t *tx_data, uint8_t *rx_data, size_t len) { + esp_err_t ret; + // ret = spi_device_set_speed(spi2, speed * 1000 * 1000); + // if (ret == ESP_OK) { + // ESP_LOGI(TAG, "EPD speed changed to 4MHz"); + // }else + // { + // ESP_LOGE(TAG, "EPD speed changed ERROR"); + // return ESP_ERR_INVALID_ARG; + // } + // 入参校验:长度为0 或 收发缓冲区同时为NULL if (len == 0 || (tx_data == NULL && rx_data == NULL)) { ESP_LOGE(TAG, "Invalid args: len=%d, tx=%p, rx=%p", len, tx_data, rx_data); @@ -85,7 +95,7 @@ esp_err_t epd_spi_send_sync_fullduplex(const uint8_t *tx_data, uint8_t *rx_data, }; // 2. 同步传输(无队列,阻塞等待硬件完成) - esp_err_t ret = spi_device_transmit(spi2, &t); + ret = spi_device_transmit(spi2, &t); if (ret != ESP_OK) { ESP_LOGE(TAG, "SPI full duplex transmit failed: %s", esp_err_to_name(ret));