1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/qn9080dk: Add ADC configuration

The QN9080DK board has 6 Analog Input lines in the J6 header, labeled
"A0" to "A5". This configuration enables these lines as ADC lines 0 to 5
as well as some other channel options available as lines 6 and up.
This commit is contained in:
iosabi 2020-12-23 04:34:11 +01:00
parent 965ebaa15b
commit e72049a180
3 changed files with 26 additions and 1 deletions

View File

@ -17,9 +17,10 @@ config BOARD_QN9080DK
# Put defined MCU peripherals here (in alphabetical order)
select BOARD_HAS_XTAL32K
select BOARD_HAS_XTAL_32M
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_PERIPH_I2C
select HAS_PERIPH_UART_MODECFG
source "$(RIOTBOARD)/common/qn908x/Kconfig"

View File

@ -2,6 +2,7 @@ CPU = qn908x
CPU_MODEL = qn9080xhn
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_timer

View File

@ -28,6 +28,29 @@
extern "C" {
#endif
/**
* @name ADC configuration
*
* Names "An" are as described in the "Analog In" header on the PCB. All "An"
* inputs are configured referenced to 1.8V.
* @{
*/
static const adc_conf_t adc_config[] = {
ADC_CHANNEL_ADC7_VINN | ADC_VINN_AVSS | ADC_VREF_GAIN_X15, /* A0 */
ADC_CHANNEL_ADC6_VINN | ADC_VINN_AVSS | ADC_VREF_GAIN_X15, /* A1 */
ADC_CHANNEL_ADC4_VINN | ADC_VINN_AVSS | ADC_VREF_GAIN_X15, /* A2 */
ADC_CHANNEL_ADC5_VINN | ADC_VINN_AVSS | ADC_VREF_GAIN_X15, /* A3 */
ADC_CHANNEL_ADC1_VINN | ADC_VINN_AVSS | ADC_VREF_GAIN_X15, /* A4 */
ADC_CHANNEL_ADC0_VINN | ADC_VINN_AVSS | ADC_VREF_GAIN_X15, /* A5 */
ADC_CHANNEL_ADC6_ADC7 | ADC_VREF_GAIN_X15, /* A1-A0 */
ADC_CHANNEL_ADC4_ADC5 | ADC_VREF_GAIN_X15, /* A2-A3 */
ADC_CHANNEL_ADC0_ADC1 | ADC_VREF_GAIN_X15, /* A5-A4 */
ADC_CHANNEL_TEMP, /* temperature */
ADC_CHANNEL_VCC4_VINN | ADC_VINN_AVSS, /* Vcc/4 */
};
#define ADC_NUMOF ARRAY_SIZE(adc_config)
/** @} */
/**
* @name I2C configuration
* @{