diff --git a/hw/bsp/ada_feather_nrf52/src/hal_bsp.c b/hw/bsp/ada_feather_nrf52/src/hal_bsp.c index 0e84aea1ed..eca0a00ca9 100644 --- a/hw/bsp/ada_feather_nrf52/src/hal_bsp.c +++ b/hw/bsp/ada_feather_nrf52/src/hal_bsp.c @@ -93,10 +93,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -220,13 +218,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c b/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c index ef8cc4f659..639277e8b2 100644 --- a/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c +++ b/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c @@ -92,10 +92,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -217,13 +215,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/bmd300eval/src/hal_bsp.c b/hw/bsp/bmd300eval/src/hal_bsp.c index d5b63ce874..b0515dba85 100644 --- a/hw/bsp/bmd300eval/src/hal_bsp.c +++ b/hw/bsp/bmd300eval/src/hal_bsp.c @@ -100,10 +100,8 @@ static const struct nrf52_hal_i2c_cfg hal_i2c_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif diff --git a/hw/bsp/dwm1001-dev/src/hal_bsp.c b/hw/bsp/dwm1001-dev/src/hal_bsp.c index b543815fbd..2d047620fc 100644 --- a/hw/bsp/dwm1001-dev/src/hal_bsp.c +++ b/hw/bsp/dwm1001-dev/src/hal_bsp.c @@ -105,10 +105,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi1s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -232,13 +230,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/nina-b1/src/hal_bsp.c b/hw/bsp/nina-b1/src/hal_bsp.c index d3ff11ce52..5ce9a6422b 100644 --- a/hw/bsp/nina-b1/src/hal_bsp.c +++ b/hw/bsp/nina-b1/src/hal_bsp.c @@ -93,10 +93,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -220,13 +218,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/nrf51-arduino_101/syscfg.yml b/hw/bsp/nrf51-arduino_101/syscfg.yml index 352f2bb0a6..00a1a86aee 100644 --- a/hw/bsp/nrf51-arduino_101/syscfg.yml +++ b/hw/bsp/nrf51-arduino_101/syscfg.yml @@ -40,16 +40,6 @@ syscfg.defs: description: 'CTS pin for UART0' value: 10 - ADC_0_REFMV_0: - description: 'reference mV in AREF0 if used' - value: 0 - ADC_0_REFMV_1: - description: 'reference mV in AREF1 if used' - value: 0 - ADC_0_REFMV_VDD: - description: 'reference mV in VDD if used' - value: 0 - SPI_0_MASTER_PIN_SCK: description: 'SCK pin for SPI_0_MASTER' value: 29 diff --git a/hw/bsp/nrf51-blenano/syscfg.yml b/hw/bsp/nrf51-blenano/syscfg.yml index c562e5d7dc..a87d0acc85 100644 --- a/hw/bsp/nrf51-blenano/syscfg.yml +++ b/hw/bsp/nrf51-blenano/syscfg.yml @@ -40,16 +40,6 @@ syscfg.defs: description: 'CTS pin for UART0' value: 10 - ADC_0_REFMV_0: - description: 'reference mV in AREF0 if used' - value: 0 - ADC_0_REFMV_1: - description: 'reference mV in AREF1 if used' - value: 0 - ADC_0_REFMV_VDD: - description: 'reference mV in VDD if used' - value: 0 - I2C_0_SDA_PIN: description: 'Data pin for I2C0' value: 6 diff --git a/hw/bsp/nrf51dk-16kbram/syscfg.yml b/hw/bsp/nrf51dk-16kbram/syscfg.yml index 22f965e282..13bb4eedec 100644 --- a/hw/bsp/nrf51dk-16kbram/syscfg.yml +++ b/hw/bsp/nrf51dk-16kbram/syscfg.yml @@ -40,17 +40,6 @@ syscfg.defs: description: 'CTS pin for UART0' value: 10 - ADC_0_REFMV_0: - description: 'reference mV in AREF0 if used' - value: 0 - ADC_0_REFMV_1: - description: 'reference mV in AREF1 if used' - value: 0 - ADC_0_REFMV_VDD: - description: 'reference mV in VDD if used' - value: 0 - - SPI_0_MASTER_PIN_SCK: description: 'SCK pin for SPI_0_MASTER' value: 29 diff --git a/hw/bsp/nrf51dk/syscfg.yml b/hw/bsp/nrf51dk/syscfg.yml index c3d5a6386b..f7be1ed476 100644 --- a/hw/bsp/nrf51dk/syscfg.yml +++ b/hw/bsp/nrf51dk/syscfg.yml @@ -40,15 +40,6 @@ syscfg.defs: description: 'CTS pin for UART0' value: 10 - ADC_0_REFMV_0: - description: 'reference mV in AREF0 if used' - value: 0 - ADC_0_REFMV_1: - description: 'reference mV in AREF1 if used' - value: 0 - ADC_0_REFMV_VDD: - description: 'reference mV in VDD if used' - value: 0 SPI_0_MASTER_PIN_SCK: description: 'SCK pin for SPI_0_MASTER' value: 29 diff --git a/hw/bsp/nrf52-thingy/src/hal_bsp.c b/hw/bsp/nrf52-thingy/src/hal_bsp.c index 2ea50d32e7..2f4e1c1654 100644 --- a/hw/bsp/nrf52-thingy/src/hal_bsp.c +++ b/hw/bsp/nrf52-thingy/src/hal_bsp.c @@ -96,6 +96,13 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { }; #endif +#if MYNEWT_VAL(ADC_0) +static struct adc_dev os_bsp_adc0; +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), +}; +#endif + #if MYNEWT_VAL(PWM_0) static struct pwm_dev os_bsp_pwm0; int pwm0_idx; @@ -269,13 +276,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/nrf52840pdk/src/hal_bsp.c b/hw/bsp/nrf52840pdk/src/hal_bsp.c index 76fca8b596..e155e85322 100644 --- a/hw/bsp/nrf52840pdk/src/hal_bsp.c +++ b/hw/bsp/nrf52840pdk/src/hal_bsp.c @@ -96,10 +96,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -232,13 +230,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/nrf52dk/src/hal_bsp.c b/hw/bsp/nrf52dk/src/hal_bsp.c index 1e3754c4ed..0afdbc145b 100644 --- a/hw/bsp/nrf52dk/src/hal_bsp.c +++ b/hw/bsp/nrf52dk/src/hal_bsp.c @@ -93,10 +93,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -220,13 +218,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/puckjs/src/hal_bsp.c b/hw/bsp/puckjs/src/hal_bsp.c index 0e84aea1ed..eca0a00ca9 100644 --- a/hw/bsp/puckjs/src/hal_bsp.c +++ b/hw/bsp/puckjs/src/hal_bsp.c @@ -93,10 +93,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -220,13 +218,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/rb-blend2/src/hal_bsp.c b/hw/bsp/rb-blend2/src/hal_bsp.c index a88d639d8d..a8608c565c 100644 --- a/hw/bsp/rb-blend2/src/hal_bsp.c +++ b/hw/bsp/rb-blend2/src/hal_bsp.c @@ -93,10 +93,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -220,13 +218,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/rb-nano2/src/hal_bsp.c b/hw/bsp/rb-nano2/src/hal_bsp.c index d4880a8633..1427d34b64 100644 --- a/hw/bsp/rb-nano2/src/hal_bsp.c +++ b/hw/bsp/rb-nano2/src/hal_bsp.c @@ -92,10 +92,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -211,13 +209,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/ruuvi_tag_revb2/src/hal_bsp.c b/hw/bsp/ruuvi_tag_revb2/src/hal_bsp.c index 6125dd1305..ef99da8082 100644 --- a/hw/bsp/ruuvi_tag_revb2/src/hal_bsp.c +++ b/hw/bsp/ruuvi_tag_revb2/src/hal_bsp.c @@ -122,13 +122,12 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif + #if MYNEWT_VAL(PWM_0) static struct pwm_dev os_bsp_pwm0; int pwm0_idx; @@ -338,13 +337,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/telee02/src/hal_bsp.c b/hw/bsp/telee02/src/hal_bsp.c index 9406878122..87bc79ba9f 100644 --- a/hw/bsp/telee02/src/hal_bsp.c +++ b/hw/bsp/telee02/src/hal_bsp.c @@ -85,10 +85,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0m_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -205,13 +203,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/bsp/vbluno52/src/hal_bsp.c b/hw/bsp/vbluno52/src/hal_bsp.c index 366cead091..3c7554e66a 100644 --- a/hw/bsp/vbluno52/src/hal_bsp.c +++ b/hw/bsp/vbluno52/src/hal_bsp.c @@ -93,10 +93,8 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = { #if MYNEWT_VAL(ADC_0) static struct adc_dev os_bsp_adc0; -static nrfx_saadc_config_t os_bsp_adc0_config = { - .resolution = MYNEWT_VAL(ADC_0_RESOLUTION), - .oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE), - .interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY), +static struct nrf52_adc_dev_cfg os_bsp_adc0_config = { + .nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0), }; #endif @@ -228,13 +226,13 @@ hal_bsp_init(void) #endif #if MYNEWT_VAL(ADC_0) -rc = os_dev_create((struct os_dev *) &os_bsp_adc0, - "adc0", - OS_DEV_INIT_KERNEL, - OS_DEV_INIT_PRIO_DEFAULT, - nrf52_adc_dev_init, - &os_bsp_adc0_config); -assert(rc == 0); + rc = os_dev_create((struct os_dev *) &os_bsp_adc0, + "adc0", + OS_DEV_INIT_KERNEL, + OS_DEV_INIT_PRIO_DEFAULT, + nrf52_adc_dev_init, + &os_bsp_adc0_config); + assert(rc == 0); #endif #if MYNEWT_VAL(PWM_0) diff --git a/hw/mcu/nordic/nrf51xxx/syscfg.yml b/hw/mcu/nordic/nrf51xxx/syscfg.yml index 91197fde67..42e608f27b 100644 --- a/hw/mcu/nordic/nrf51xxx/syscfg.yml +++ b/hw/mcu/nordic/nrf51xxx/syscfg.yml @@ -75,6 +75,16 @@ syscfg.defs: description: 'ADC' value: 0 + ADC_0_REFMV_0: + description: 'reference mV in AREF0 if used' + value: 0 + ADC_0_REFMV_1: + description: 'reference mV in AREF1 if used' + value: 0 + ADC_0_REFMV_VDD: + description: 'reference mV in VDD if used' + value: 0 + # The XTAL_xxx definitions are used to set the clock source used for the low # frequency clock. It is required that at least one of these sources is # enabled (the bsp should set one of these clock sources). diff --git a/hw/mcu/nordic/nrf52xxx/syscfg.yml b/hw/mcu/nordic/nrf52xxx/syscfg.yml index 612503c01d..ecabe56633 100644 --- a/hw/mcu/nordic/nrf52xxx/syscfg.yml +++ b/hw/mcu/nordic/nrf52xxx/syscfg.yml @@ -86,17 +86,9 @@ syscfg.defs: description: 'NRF52 ADC 0' value: 0 - ADC_0_RESOLUTION: - description: 'NRF52 ADC 0 RESOLUTION' - value: 'NRFX_SAADC_CONFIG_RESOLUTION' - - ADC_0_OVERSAMPLE: - description: 'NRF52 ADC 0 OVERSAMPLE' - value: 'NRFX_SAADC_CONFIG_OVERSAMPLE' - - ADC_0_INTERRUPT_PRIORITY: - description: 'NRF52 ADC IRQ PRIORITY' - value: 'NRFX_SAADC_CONFIG_IRQ_PRIORITY' + ADC_0_REFMV_0: + description: 'reference mV in AREF0 if used' + value: 0 PWM_0: description: 'NRF52 PWM 0'