diff --git a/boards/common/esp32/include/periph_conf_common.h b/boards/common/esp32/include/periph_conf_common.h index 20d412c9e4..6b5af62511 100644 --- a/boards/common/esp32/include/periph_conf_common.h +++ b/boards/common/esp32/include/periph_conf_common.h @@ -251,6 +251,40 @@ static const pwm_config_t pwm_config[] = /** @} */ +/** + * @name RMT configuration + * @{ + */ + +/** + * @brief RMT channel configuration + * + * For the moment, the only RMT channel configuration used is for the WS2812 + * driver. To override this default configuration by a board definition, add + * ``` + * #define HAVE_RMT_CHANNEL_CONFIG + * ``` + * before including this file and define an according `rmt_channel_config` + * after including this file. + */ +#ifndef HAVE_RMT_CHANNEL_CONFIG +static const rmt_channel_config_t rmt_channel_config[] = { +#ifdef WS281X_PARAM_PIN + { 0, WS281X_PARAM_PIN }, +#else + /* default for boards that don't define WS281X_PARAM_PIN */ + { 0, GPIO0 }, +#endif +}; +#endif + +/** + * @brief Number of RMT channels + */ +#define RMT_CH_NUMOF ARRAY_SIZE(rmt_channel_config) + +/** @} */ + /** * @name SPI configuration * @{ diff --git a/boards/common/esp32c3/include/periph_conf_common.h b/boards/common/esp32c3/include/periph_conf_common.h index 2372799dbf..238d1d8288 100644 --- a/boards/common/esp32c3/include/periph_conf_common.h +++ b/boards/common/esp32c3/include/periph_conf_common.h @@ -233,6 +233,40 @@ static const pwm_config_t pwm_config[] = /** @} */ +/** + * @name RMT configuration + * @{ + */ + +/** + * @brief RMT channel configuration + * + * For the moment, the only RMT channel configuration used is for the WS2812 + * driver. To override this default configuration by a board definition, add + * ``` + * #define HAVE_RMT_CHANNEL_CONFIG + * ``` + * before including this file and define an according `rmt_channel_config` + * after including this file. + */ +#ifndef HAVE_RMT_CHANNEL_CONFIG +static const rmt_channel_config_t rmt_channel_config[] = { +#ifdef WS281X_PARAM_PIN + { 0, WS281X_PARAM_PIN }, +#else + /* default for boards that don't define WS281X_PARAM_PIN */ + { 0, GPIO0 }, +#endif +}; +#endif + +/** + * @brief Number of RMT channels + */ +#define RMT_CH_NUMOF ARRAY_SIZE(rmt_channel_config) + +/** @} */ + /** * @name SPI configuration * @{ diff --git a/boards/common/esp32s2/include/periph_conf_common.h b/boards/common/esp32s2/include/periph_conf_common.h index 2258acf5b5..602cf4d121 100644 --- a/boards/common/esp32s2/include/periph_conf_common.h +++ b/boards/common/esp32s2/include/periph_conf_common.h @@ -252,6 +252,40 @@ static const pwm_config_t pwm_config[] = /** @} */ +/** + * @name RMT configuration + * @{ + */ + +/** + * @brief RMT channel configuration + * + * For the moment, the only RMT channel configuration used is for the WS2812 + * driver. To override this default configuration by a board definition, add + * ``` + * #define HAVE_RMT_CHANNEL_CONFIG + * ``` + * before including this file and define an according `rmt_channel_config` + * after including this file. + */ +#ifndef HAVE_RMT_CHANNEL_CONFIG +static const rmt_channel_config_t rmt_channel_config[] = { +#ifdef WS281X_PARAM_PIN + { 0, WS281X_PARAM_PIN }, +#else + /* default for boards that don't define WS281X_PARAM_PIN */ + { 0, GPIO0 }, +#endif +}; +#endif + +/** + * @brief Number of RMT channels + */ +#define RMT_CH_NUMOF ARRAY_SIZE(rmt_channel_config) + +/** @} */ + /** * @name SPI configuration * @{ diff --git a/boards/common/esp32s3/include/periph_conf_common.h b/boards/common/esp32s3/include/periph_conf_common.h index 2e7c2a1232..120fdd526a 100644 --- a/boards/common/esp32s3/include/periph_conf_common.h +++ b/boards/common/esp32s3/include/periph_conf_common.h @@ -252,6 +252,40 @@ static const pwm_config_t pwm_config[] = /** @} */ +/** + * @name RMT configuration + * @{ + */ + +/** + * @brief RMT channel configuration + * + * For the moment, the only RMT channel configuration used is for the WS2812 + * driver. To override this default configuration by a board definition, add + * ``` + * #define HAVE_RMT_CHANNEL_CONFIG + * ``` + * before including this file and define an according `rmt_channel_config` + * after including this file. + */ +#ifndef HAVE_RMT_CHANNEL_CONFIG +static const rmt_channel_config_t rmt_channel_config[] = { +#ifdef WS281X_PARAM_PIN + { 0, WS281X_PARAM_PIN }, +#else + /* default for boards that don't define WS281X_PARAM_PIN */ + { 0, GPIO0 }, +#endif +}; +#endif + +/** + * @brief Number of RMT channels + */ +#define RMT_CH_NUMOF ARRAY_SIZE(rmt_channel_config) + +/** @} */ + /** * @name SPI configuration * @{