Re: button1 GPIOTE interrupt enable for NRF52840_PCA10056


Carles Cufi
 

Hi Vikrant,

 

Why don’t you use the existing GPIO driver?

https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/gpio/gpio_nrf5.c

 

It works with the button sample.

 

Regards,

 

Carles

 

From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Vikrant More
Sent: 28 November 2017 14:32
To: zephyr-devel@...; zephyr-users@...
Subject: [Zephyr-devel] button1 GPIOTE interrupt enable for NRF52840_PCA10056

 

Hello,

I want to enable GPIOTE interrupt for for Button1. For that I write

void GPIOTE_IRQHandler(void *arg)
{

 

  if(NRF_GPIOTE->EVENTS_IN[0]!=0)
  {
    NRF_GPIOTE->EVENTS_IN[0]=0;

    NRF_P0->OUT ^= (1<<16);

  }
}

void gpio_init(void)
{

 

 

  NRF_P0->DIR |= 0x0001E000;           // for LEDs
  NRF_P0->OUTSET |= 0x0001E000;   // for LEDs

 

 

 

  NRF_P0->PIN_CNF[11]=0x0000000C;   // for making P0.11 as input

  NRF_GPIOTE->INTENSET |= 0x00000001;                         
  NRF_GPIOTE->CONFIG[0] |= 0x00000001 | (11<<8) | (2<<16);

  NVIC_EnableIRQ(GPIOTE_IRQn);
}

 

I am able to compile code successfully & as per my understanding after pressing Button1,

Led4 should toggle on every click.

 

But I think interrupt is not get executed.

 

 

Could anybody help me to solve this issue ?

 

 

How to rewrite logic as per it ? how to modify prj.conf ?

 

 

Thank You!!

Join devel@lists.zephyrproject.org to automatically receive all group messages.