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

PORT Event vs nrf_drv_gpiote_in_init()

nrf_drv_gpiote_in_config_t in_config_lotohi = GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
if(!nrf_drv_gpiote_is_init())
{
    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
}
err_code = nrf_drv_gpiote_in_init(GPIO_AC_INTP1_PIN, &in_config_lotohi, key_event_handler);
  1. my code is just like above
  2. I know the difference between IN EVENT and PORT event
  3. If I use nrf_drv_gpiote_init() with GPIOTE_CONFIG_IN_SENSE_LOTOHI(false), that means I use Port Event? or same current consumption as Port Event? or it use IN EVENT?
Parents
  • Hi,

    If you set the flag to true you use IN_EVENT(high accuracy mode), if you set the flag to false you use PORT event (low accuracy mode).

    GPIOTE_CONFIG_IN_SENSE_LOTOHI(false) is a PORT event

    GPIOTE_CONFIG_IN_SENSE_LOTOHI(true) is an IN_EVENT.

    See API Reference here.

  • 1:

    For high accuracy mode(IN_EVENT) there is a limit of 8 pins on the nRF52. On nRF51 the limit is 4. This limit is set by the number of GPIOTE channels available. For low accuracy mode (PORT event) there is no such limit. You must specify GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS, which is the number of pins used for low power EVENTS_PORT. This define can be found in sdk_config.h

    2:

    Yes, you need to call nrf_drv_gpiote_init() if you want to use PORT or IN_EVENT. This function is needed for initializing the GPIOTE module.

    3:

    Yes, you can do that. Also, for buttons you might want to look into the app_button library if you have problem with debounce on the buttons(so a single button press doesn't appear like multiple presses).

Reply
  • 1:

    For high accuracy mode(IN_EVENT) there is a limit of 8 pins on the nRF52. On nRF51 the limit is 4. This limit is set by the number of GPIOTE channels available. For low accuracy mode (PORT event) there is no such limit. You must specify GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS, which is the number of pins used for low power EVENTS_PORT. This define can be found in sdk_config.h

    2:

    Yes, you need to call nrf_drv_gpiote_init() if you want to use PORT or IN_EVENT. This function is needed for initializing the GPIOTE module.

    3:

    Yes, you can do that. Also, for buttons you might want to look into the app_button library if you have problem with debounce on the buttons(so a single button press doesn't appear like multiple presses).

Children
No Data
Related