Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf52 adc fixes #957

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 9 additions & 10 deletions hw/bsp/ada_feather_nrf52/src/hal_bsp.c
Expand Up @@ -45,6 +45,7 @@
#include "bsp.h"
#if MYNEWT_VAL(ADC_0)
#include <adc_nrf52/adc_nrf52.h>
#include <nrfx_saadc.h>
#endif
#if MYNEWT_VAL(PWM_0) || MYNEWT_VAL(PWM_1) || MYNEWT_VAL(PWM_2)
#include <pwm_nrf52/pwm_nrf52.h>
Expand Down Expand Up @@ -96,9 +97,7 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = {
#if MYNEWT_VAL(ADC_0)
static struct adc_dev os_bsp_adc0;
static struct nrf52_adc_dev_cfg os_bsp_adc0_config = {
.saadc_cfg.resolution = MYNEWT_VAL(ADC_0_RESOLUTION),
.saadc_cfg.oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE),
.saadc_cfg.interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY),
.nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0),
};
#endif

Expand Down Expand Up @@ -222,13 +221,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)
Expand Down
21 changes: 10 additions & 11 deletions hw/bsp/arduino_primo_nrf52/src/hal_bsp.c
Expand Up @@ -44,6 +44,7 @@
#include "bsp.h"
#if MYNEWT_VAL(ADC_0)
#include <adc_nrf52/adc_nrf52.h>
#include <nrfx_saadc.h>
#endif
#if MYNEWT_VAL(PWM_0) || MYNEWT_VAL(PWM_1) || MYNEWT_VAL(PWM_2)
#include <pwm_nrf52/pwm_nrf52.h>
Expand Down Expand Up @@ -94,10 +95,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 nrf52_adc_dev_cfg os_bsp_adc0_config = {
.saadc_cfg.resolution = MYNEWT_VAL(ADC_0_RESOLUTION),
.saadc_cfg.oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE),
.saadc_cfg.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

Expand Down Expand Up @@ -219,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)
Expand Down
1 change: 1 addition & 0 deletions hw/bsp/bmd200/src/hal_bsp.c
Expand Up @@ -39,6 +39,7 @@

#if MYNEWT_VAL(ADC_0)
#include <adc_nrf51/adc_nrf51.h>
#include <nrfx_adc.h>
#endif

#if MYNEWT_VAL(UART_0)
Expand Down
5 changes: 2 additions & 3 deletions hw/bsp/bmd300eval/src/hal_bsp.c
Expand Up @@ -42,6 +42,7 @@
#include "bsp.h"
#if MYNEWT_VAL(ADC_0)
#include <adc_nrf52/adc_nrf52.h>
#include <nrfx_saadc.h>
#endif
#if MYNEWT_VAL(PWM_0) || MYNEWT_VAL(PWM_1) || MYNEWT_VAL(PWM_2)
#include <pwm_nrf52/pwm_nrf52.h>
Expand Down Expand Up @@ -93,9 +94,7 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = {
#if MYNEWT_VAL(ADC_0)
static struct adc_dev os_bsp_adc0;
static struct nrf52_adc_dev_cfg os_bsp_adc0_config = {
.saadc_cfg.resolution = MYNEWT_VAL(ADC_0_RESOLUTION),
.saadc_cfg.oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE),
.saadc_cfg.interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY),
.nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0),
};
#endif

Expand Down
1 change: 1 addition & 0 deletions hw/bsp/calliope_mini/src/hal_bsp.c
Expand Up @@ -36,6 +36,7 @@

#if MYNEWT_VAL(ADC_0)
#include <adc_nrf51/adc_nrf51.h>
#include <nrfx_adc.h>
#endif

#if MYNEWT_VAL(UART_0)
Expand Down
19 changes: 9 additions & 10 deletions hw/bsp/dwm1001-dev/src/hal_bsp.c
Expand Up @@ -45,6 +45,7 @@
#include "bsp.h"
#if MYNEWT_VAL(ADC_0)
#include <adc_nrf52/adc_nrf52.h>
#include <nrfx_saadc.h>
#endif
#if MYNEWT_VAL(PWM_0) || MYNEWT_VAL(PWM_1) || MYNEWT_VAL(PWM_2)
#include <pwm_nrf52/pwm_nrf52.h>
Expand Down Expand Up @@ -108,9 +109,7 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi1s_cfg = {
#if MYNEWT_VAL(ADC_0)
static struct adc_dev os_bsp_adc0;
static struct nrf52_adc_dev_cfg os_bsp_adc0_config = {
.saadc_cfg.resolution = MYNEWT_VAL(ADC_0_RESOLUTION),
.saadc_cfg.oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE),
.saadc_cfg.interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY),
.nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0),
};
#endif

Expand Down Expand Up @@ -234,13 +233,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)
Expand Down
19 changes: 9 additions & 10 deletions hw/bsp/nina-b1/src/hal_bsp.c
Expand Up @@ -45,6 +45,7 @@
#include "bsp.h"
#if MYNEWT_VAL(ADC_0)
#include <adc_nrf52/adc_nrf52.h>
#include <nrfx_saadc.h>
#endif
#if MYNEWT_VAL(PWM_0) || MYNEWT_VAL(PWM_1) || MYNEWT_VAL(PWM_2)
#include <pwm_nrf52/pwm_nrf52.h>
Expand Down Expand Up @@ -96,9 +97,7 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = {
#if MYNEWT_VAL(ADC_0)
static struct adc_dev os_bsp_adc0;
static struct nrf52_adc_dev_cfg os_bsp_adc0_config = {
.saadc_cfg.resolution = MYNEWT_VAL(ADC_0_RESOLUTION),
.saadc_cfg.oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE),
.saadc_cfg.interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY),
.nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0),
};
#endif

Expand Down Expand Up @@ -222,13 +221,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)
Expand Down
1 change: 1 addition & 0 deletions hw/bsp/nrf51-arduino_101/src/hal_bsp.c
Expand Up @@ -41,6 +41,7 @@

#if MYNEWT_VAL(ADC_0)
#include <adc_nrf51/adc_nrf51.h>
#include <nrfx_adc.h>
#endif

#if MYNEWT_VAL(UART_0)
Expand Down
10 changes: 0 additions & 10 deletions hw/bsp/nrf51-arduino_101/syscfg.yml
Expand Up @@ -40,16 +40,6 @@ syscfg.defs:
description: 'CTS pin for UART0'
value: 10

ADC_0_REFMV_0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we remove ADC_0_REFMV_0:? isn't used above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update: Ah I see you moved it to nrf51xxx which is fine however this is not related to this issue. I would suggest separate patch for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id rather fix it here once and for all than edit a bunch more bsps

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
Expand Down
1 change: 1 addition & 0 deletions hw/bsp/nrf51-blenano/src/hal_bsp.c
Expand Up @@ -34,6 +34,7 @@

#if MYNEWT_VAL(ADC_0)
#include <adc_nrf51/adc_nrf51.h>
#include <nrfx_adc.h>
#endif

#if MYNEWT_VAL(I2C_0) || MYNEWT_VAL(I2C_1)
Expand Down
10 changes: 0 additions & 10 deletions hw/bsp/nrf51-blenano/syscfg.yml
Expand Up @@ -40,16 +40,6 @@ syscfg.defs:
description: 'CTS pin for UART0'
value: 10

ADC_0_REFMV_0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we miss related changes in hal_bsp.c for this bsp?

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
Expand Down
1 change: 1 addition & 0 deletions hw/bsp/nrf51dk-16kbram/src/hal_bsp.c
Expand Up @@ -39,6 +39,7 @@

#if MYNEWT_VAL(ADC_0)
#include <adc_nrf51/adc_nrf51.h>
#include <nrfx_adc.h>
#endif

#if MYNEWT_VAL(UART_0)
Expand Down
11 changes: 0 additions & 11 deletions hw/bsp/nrf51dk-16kbram/syscfg.yml
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hw/bsp/nrf51dk/src/hal_bsp.c
Expand Up @@ -34,6 +34,7 @@

#if MYNEWT_VAL(ADC_0)
#include <adc_nrf51/adc_nrf51.h>
#include <nrfx_adc.h>
#endif

#if MYNEWT_VAL(UART_0) || MYNEWT_VAL(UART_1)
Expand Down
9 changes: 0 additions & 9 deletions hw/bsp/nrf51dk/syscfg.yml
Expand Up @@ -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
Expand Down
18 changes: 8 additions & 10 deletions hw/bsp/nrf52-thingy/src/hal_bsp.c
Expand Up @@ -103,9 +103,7 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = {
#if MYNEWT_VAL(ADC_0)
static struct adc_dev os_bsp_adc0;
static struct nrf52_adc_dev_cfg os_bsp_adc0_config = {
.saadc_cfg.resolution = MYNEWT_VAL(ADC_0_RESOLUTION),
.saadc_cfg.oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE),
.saadc_cfg.interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY),
.nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0),
};
#endif

Expand Down Expand Up @@ -282,13 +280,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)
Expand Down
19 changes: 9 additions & 10 deletions hw/bsp/nrf52840pdk/src/hal_bsp.c
Expand Up @@ -45,6 +45,7 @@
#include "bsp.h"
#if MYNEWT_VAL(ADC_0)
#include <adc_nrf52/adc_nrf52.h>
#include <nrfx_saadc.h>
#endif
#if MYNEWT_VAL(PWM_0) || \
MYNEWT_VAL(PWM_1) || \
Expand Down Expand Up @@ -99,9 +100,7 @@ static const struct nrf52_hal_spi_cfg os_bsp_spi0s_cfg = {
#if MYNEWT_VAL(ADC_0)
static struct adc_dev os_bsp_adc0;
static struct nrf52_adc_dev_cfg os_bsp_adc0_config = {
.saadc_cfg.resolution = MYNEWT_VAL(ADC_0_RESOLUTION),
.saadc_cfg.oversample = MYNEWT_VAL(ADC_0_OVERSAMPLE),
.saadc_cfg.interrupt_priority = MYNEWT_VAL(ADC_0_INTERRUPT_PRIORITY),
.nadc_refmv = MYNEWT_VAL(ADC_0_REFMV_0),
};
#endif

Expand Down Expand Up @@ -229,13 +228,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)
Expand Down