@@ -115,6 +115,44 @@ static const spi_conf_t spi_config[] = {
115115#define SPI_NUMOF ARRAY_SIZE(spi_config)
116116/** @} */
117117
118+ /**
119+ * @brief ADC configuration
120+ *
121+ * Note that we do not configure all ADC channels,
122+ * and not in the STM32L432KC order. Instead, we
123+ * just define 5 ADC channels, for the Nucleo
124+ * Arduino Nano header pins A0-A3 and A6 - all which are
125+ * enabled by default and without collision with other
126+ * features, for example, I2C or VCP_TX.
127+ *
128+ * To find appropriate device and channel find in the
129+ * board manual, table showing pin assignments and
130+ * information about ADC - a text similar to ADC[X]_IN[Y],
131+ * where:
132+ * [X] - describes used device - indexed from 0,
133+ * for example ADC1_IN10 is device 0,
134+ * [Y] - describes used channel - indexed from 1,
135+ * for example ADC1_IN10 is channel 10
136+ *
137+ * For Nucleo-L432KC this information is in board manual,
138+ * Table 16 or STM32L432KC MCU datasheet - Table 14.
139+ * @{
140+ */
141+ static const adc_conf_t adc_config [] = {
142+ {GPIO_PIN (PORT_A , 0 ), .dev = 0 , .chan = 5 }, /* ADC12_IN5 */
143+ {GPIO_PIN (PORT_A , 1 ), .dev = 0 , .chan = 6 }, /* ADC12_IN6 */
144+ {GPIO_PIN (PORT_A , 3 ), .dev = 0 , .chan = 8 }, /* ADC12_IN8 */
145+ {GPIO_PIN (PORT_A , 4 ), .dev = 0 , .chan = 9 }, /* ADC12_IN9 */
146+ {GPIO_PIN (PORT_A , 7 ), .dev = 0 , .chan = 12 }, /* ADC12_IN12 */
147+ };
148+
149+ /**
150+ * @brief Number of ADC devices
151+ */
152+ #define ADC_NUMOF ARRAY_SIZE(adc_config)
153+
154+ /** @} */
155+
118156#ifdef __cplusplus
119157}
120158#endif
0 commit comments