how to get real gpio high/low

Hi Nordic,

I am working with nRF52840, sdk17.1.0 and do the following test:

I use nrf_gpio_cfg_output(), nrf_gpio_pin_set(); to set gpio P1.00 to high and use nrf_gpio_pin_input_get() to read gpio level and the value is 1 (HIGH).

Next, I use a line to short P1.00 and ground and use rf_gpio_pin_input_get() to read gpio level and the value is "still" 1 (HIGH).    // I am supposed to get LOW

My questions are:

1. why can't get real high/low value?

2. I look into source code, does cod just return high/low form setting?

__STATIC_INLINE nrf_gpio_pin_input_t nrf_gpio_pin_input_get(uint32_t pin_number)
{
NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number);

return (nrf_gpio_pin_input_t)((reg->PIN_CNF[pin_number] &
GPIO_PIN_CNF_INPUT_Msk) >> GPIO_PIN_CNF_INPUT_Pos);
}

3. Are there other functions to get real value?

best regards,

Gavin

Parents Reply Children
Related