一、更新文件
lv_binding_micropython:GitHub - kdschlosser/lv_binding_micropython at esp32-s-c-h_support
下载lv_binding_micropython分支:
git clone -b esp32-s-c-h_support https://github.com/kdschlosser/lv_binding_micropython.git
替换文件:
拷贝lv_binding_micropython/下的所有文件,覆盖lv_micropython/lib/lv_bindings/下的文件。
二、根据错误修改源文件
1、错误1
error: implicit declaration of function 'I2S_TIMING_REG'; did you mean 'I2S_RX_TIMING_REG'? [-Werror=implicit-function-declaration]REG_SET_BIT( I2S_TIMING_REG(i2s_num), BIT(9));
文件lv_micropython/lib/lv_bindings/driver/esp32/espidf.h
修改代码
static inline void SPH0645_WORKAROUND(int i2s_num)
{REG_SET_BIT( I2S_TIMING_REG(i2s_num), BIT(9));REG_SET_BIT( I2S_CONF_REG(i2s_num), I2S_RX_MSB_SHIFT);
}
改为:
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2REG_SET_BIT( I2S_TIMING_REG(i2s_num), BIT(9));REG_SET_BIT( I2S_CONF_REG(i2s_num), I2S_RX_MSB_SHIFT);
#elif CONFIG_IDF_TARGET_ESP32S3REG_SET_BIT( I2S_RX_TIMING_REG(i2s_num), BIT(9));REG_SET_BIT( I2S_RX_CONF_REG(i2s_num), I2S_RX_MSB_SHIFT);
#endif
2、错误2
/home/caiyong/share/lv_micropython/lib/lv_bindings/driver/esp32/espidf.h:180:21: error: 'SPI_HOST' undeclared here (not in a function); did you mean 'SPI3_HOST'?ENUM_SPI_HOST = SPI_HOST,^~~~~~~~SPI3_HOST
/home/caiyong/share/lv_micropython/lib/lv_bindings/driver/esp32/espidf.h:181:22: error: 'HSPI_HOST' undeclared here (not in a function); did you mean 'SPI3_HOST'?ENUM_HSPI_HOST = HSPI_HOST,^~~~~~~~~SPI3_HOST
/home/caiyong/share/lv_micropython/lib/lv_bindings/driver/esp32/espidf.h:182:22: error: 'VSPI_HOST' undeclared here (not in a function); did you mean 'SPI3_HOST'?ENUM_VSPI_HOST = VSPI_HOST,^~~~~~~~~SPI3_HOST
文件lv_micropython/lib/lv_bindings/driver/esp32/espidf.h
// SPI HOST enum was changed to macros on v4
enum {ENUM_SPI_HOST = SPI_HOST,ENUM_HSPI_HOST = HSPI_HOST,ENUM_VSPI_HOST = VSPI_HOST,
};
改为
// SPI HOST enum was changed to macros on v4
enum {
#if CONFIG_IDF_TARGET_ESP32ENUM_SPI_HOST = SPI_HOST,ENUM_HSPI_HOST = HSPI_HOST,ENUM_VSPI_HOST = VSPI_HOST,
#elif CONFIG_IDF_TARGET_ESP32S3ENUM_SPI_HOST = SPI1_HOST,ENUM_HSPI_HOST = SPI2_HOST,ENUM_VSPI_HOST = SPI3_HOST,
#endif
};
3、错误3
error: 'ADC1_GPIO36_CHANNEL' undeclared here (not in a function); did you mean 'ADC1_GPIO6_CHANNEL'?#define GPIO_TO_ADC_ELEMENT(x) [x] = CONCAT3(ADC1_GPIO, x, _CHANNEL)
文件:lv_micropython/lib/lv_bindings/driver/esp32/modrtch.c
将代码
#define GPIO_TO_ADC_ELEMENT(x) [x] = CONCAT3(ADC1_GPIO, x, _CHANNEL)
static const int gpio_to_adc[] = {GPIO_TO_ADC_ELEMENT(36),GPIO_TO_ADC_ELEMENT(37),GPIO_TO_ADC_ELEMENT(38),GPIO_TO_ADC_ELEMENT(39),GPIO_TO_ADC_ELEMENT(32),GPIO_TO_ADC_ELEMENT(33),GPIO_TO_ADC_ELEMENT(34),GPIO_TO_ADC_ELEMENT(35),
};
改为
4、错误4
error: implicit declaration of function 'adc_gpio_init'; did you mean 'gpio_init'? [-Werror=implicit-function-declaration]adc_gpio_init(ADC_UNIT_1, adc_channel);^~~~~~~~~~~~~gpio_init
adc_gpio_init(ADC_UNIT_1, adc_channel);
改为
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2adc_gpio_init(ADC_UNIT_1, adc_channel);
#endif
5、错误5