This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to set the GPIO as input and high LOW pin?

I am using nrf52832 ble, I want to set the pin P0.2 low as analog input and p0.3 high as analog input .

#define AIN0 2        // analog pin p0.2

#define AIN1 3

#define AIN0_PIN_CONFIG_HIGH ((GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos)     | \
                           (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)    | \
                           (NRF_GPIO_PIN_PULLDOWN << GPIO_PIN_CNF_PULL_Pos)                 | \
                           (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | \
                           (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos))
#define AIN1_PIN_CONFIG_LOW ((GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos)     | \
                           (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos)    | \
                           (NRF_GPIO_PIN_PULLDOWN << GPIO_PIN_CNF_PULL_Pos)                 | \
                           (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | \
                           (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos))

is this correct?

Related