Skip to content

Commit 372f97c

Browse files
committed
boards/esp32: DAC config approach changed
DAC pins are now configured using static arrays in header files instead of static variables in implementation to be able to define DAC_NUMOF using the size of these arrays instead of a variable.
1 parent bc0c946 commit 372f97c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

boards/common/esp32/include/periph_conf_common.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ extern "C" {
7373
#define DAC_GPIOS { }
7474
#endif
7575

76+
/**
77+
* @brief Static array with declared DAC channels
78+
*/
79+
static const gpio_t dac_channels[] = DAC_GPIOS;
80+
7681
/**
7782
* @brief Number of GPIOs declared as DAC channels
7883
*
@@ -81,7 +86,7 @@ extern "C" {
8186
*
8287
* @note DAC_NUMOF definition must not be changed.
8388
*/
84-
#define DAC_NUMOF (dac_chn_num)
89+
#define DAC_NUMOF (sizeof(dac_channels) / sizeof(dac_channels[0]))
8590
/** @} */
8691

8792

0 commit comments

Comments
 (0)