Hi,
I just tried to toggle a led when a particular button in the evaluation board (nrf51822) is pressed, i just referred the gpiote sample code and started modifying it. Below is my code snippet, please help me to overcome this.
static void gpiote_init(void)
{
nrf_gpio_cfg_input(BUTTON_0, NRF_GPIO_PIN_NOPULL);
nrf_gpiote_event_config(0,16,2);
nrf_gpio_cfg_output(18);
nrf_gpiote_task_config(0, 18, 2, 0);
}
static void ppi_init(void)
{
NRF_PPI->CH[0].EEP = (uint32_t)&NRF_GPIOTE->EVENTS_IN[0];
NRF_PPI->CH[0].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0];
// Enable PPI channel 0
NRF_PPI->CHEN = (PPI_CHEN_CH0_Enabled << PPI_CHEN_CH0_Pos);
}
int main(void)
{
gpiote_init();
ppi_init();
Regards, Balaji