Hello,
I am doing a project on a NRF52DK, using SDK15 and SES.
I have been trying to implement a basic feature, which will be a part of a bigger system:
- Detect interrupt from sensor (HIGH or LOW)
- When HIGH:
- //do something
- When LOW
- //do something else
How should I do it? I have been looking into examples such as pin_change_int, gpiote, simple_timer and bsp but have not gotten them to work on both states, only on state change, using the bsp_init() or GPIOE.
I think that the function I should be looking into is "bsp_event_to_button_action_assign()" from "bsp.c" but due to my inexperience, I have not figured out how.
I could compile:
err_code = bsp_event_to_button_action_assign(2, BSP_BUTTON_ACTION_LONG_PUSH, BSP_EVENT_KEY_2_ACTIVE);
APP_ERROR_CHECK(err_code);
... where 2 is just the GPIO pin where the interrupt would happen, long push would be the action and BSP_EVENT_KEY_2_ACTIVE is my added special event at bsp_event_t type definition but I have not figured out how to make a function like that in my main.c.
Ideally I would like to have a function, which uses a switch statement on events (yes, just like bsp_event_handler) but according to my own rules, without modifying the libraries - instead of using them.
I have found a lot of useful links but basically all of them are for SDK11, which is very frustrating as version 15 is pretty different and I would like to make this project on the latest version.
I apologize for the confusion. I have just started with nRF development and I am coming from Arduino platform. If you have any suggestions or would like more information, then let me know and I can try them out and post the output. If I am on the wrong track or you have any useful links for SDK 15, then let me know.