Hello,
I guess it is a simple problem, but I am new to the nrf world, so here is my issue:
#include <stdint.h>
#include <string.h>
#include "nordic_common.h"
#include "boards.h"
#include "pca10059.h"
#include "app_timer.h"
#include "app_button.h"
#include "app_scheduler.h"
static void button_handler(uint8_t pin, uint8_t action)
{
if (pin == BSP_BUTTON_0){
if (action == APP_BUTTON_PUSH){
bsp_board_led_on(BSP_BOARD_LED_0);
} else if (action == APP_BUTTON_RELEASE){
bsp_board_led_off(BSP_BOARD_LED_0);
}
}
}
/**@brief Function for application main entry.
*/
int main()
{
bsp_board_init(BSP_INIT_LEDS);
app_timer_init();
//The array must be static because a pointer to it will be saved in the button handler module.
static app_button_cfg_t buttons[] =
{
{BSP_BUTTON_0, false, BUTTON_PULL, button_handler}
};
app_button_init(buttons, ARRAY_SIZE(buttons), APP_TIMER_TICKS(50));
app_button_enable();
}
/**
* @}
*/
I want to use this code to switch on a LED by pressing the on board button (BSP_BUTTON_0) on my nrf dongle. But when I run it and press the button, no interrupt is fired and nothing happens. But if I add a softdevice and add
nrf_sdh_enable_request();
to my main, it works perfectly. So, is there a way to get this code running without any softdevice? And why is it just working with it?
Thanks
Maboo
Ps: I am using SDK17 on Linux, VS Code