Skip to content

Commit 7e8a1c1

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 0510f0c commit 7e8a1c1

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
@@ -78,6 +78,11 @@ static const gpio_t adc_channels[] = ADC_GPIOS;
7878
#define DAC_GPIOS { }
7979
#endif
8080

81+
/**
82+
* @brief Static array with declared DAC channels
83+
*/
84+
static const gpio_t dac_channels[] = DAC_GPIOS;
85+
8186
/**
8287
* @brief Number of GPIOs declared as DAC channels
8388
*
@@ -86,7 +91,7 @@ static const gpio_t adc_channels[] = ADC_GPIOS;
8691
*
8792
* @note DAC_NUMOF definition must not be changed.
8893
*/
89-
#define DAC_NUMOF (dac_chn_num)
94+
#define DAC_NUMOF (sizeof(dac_channels) / sizeof(dac_channels[0]))
9095
/** @} */
9196

9297

0 commit comments

Comments
 (0)