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

How to use Buttons input as GPIO

Hi, i'am working on a custom board on which there is two led drive by a led driver.

The two leds are wiring to be drive by pins P0.14 and P0.15, but unfortunately these pins are consider to be button with:

uint32_t err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), bsp_event_handler);

I've try to remplace BSP_INIT_LED | BSP_INIT_BUTTONS by BSP_INIT_NONE but now I can't control output with nrf_drv_gpiote_out_set or get an input with nrf_gpio_cfg_sense_input.

So i there a solution,for uninitalize button from P0.13 to P0.16 without lose gpiote ?

Thanks you !

Parents
  • Hi Maxim,

    this is specific to particular board layout. Does it mean that you want to use some specific Dev Kit from Nordic? Then you need to tell us which and what revision. All the latest revisions of nRF51 and nRF52 DK have Arduino style headers including disabling circuit for buttons and LEDs. So simply read User Guide, ground specific PIN and you can repurpose nRF5x PINs for any GPIO task without dealing with buttons and LEDs on the DK board. To have it complete just create custom header file for board configuration (there is nice hook ready in the SDK projects) so you can still use all the modules with predefined symbols etc.

    Cheers Jan

  • Well the idea is to use BOARD_CUSTOM define so in \examples\bsp\boards.h it refers to custom_board.h which is the file you should create and fill within your own project folder. Editing SDK files like this is kind of a red flag for me but sure, it will do the job.

Reply Children
No Data
Related