Simple hardware abstraction layer for the example applications. More...
Macros | |
#define | HAL_BUTTON_PRESS_DEBOUNCE_INTERVAL MS_TO_US(400) |
Acceptable button press interval in microseconds. More... | |
#define | HAL_LED_BLINK_PERIOD_MIN_MS (20) |
Lowest possible blinking period in milliseconds. More... | |
#define | LED_MASK_STATE_OFF (false) |
Set LED Mask state to Off. More... | |
#define | LED_MASK_STATE_ON (true) |
Set LED Mask state to On. More... | |
#define | HAL_LED_MASK ((1 << LEDS_NUMBER) - 1) |
LEDs mask full. | |
#define | HAL_LED_MASK_HALF ((1 << (LEDS_NUMBER/2)) - 1) |
LEDs mask half. | |
#define | HAL_LED_MASK_LOWER_HALF (HAL_LED_MASK_HALF) |
#define | HAL_LED_MASK_UPPER_HALF (HAL_LED_MASK ^ HAL_LED_MASK_HALF) |
#define | BUTTON_BOARD |
Boards with user buttons. More... | |
Typedefs | |
typedef void(* | hal_button_handler_cb_t) (uint32_t button_number) |
Button event handler callback type. More... | |
Functions | |
void | hal_leds_init (void) |
Initializes the LEDs. More... | |
uint32_t | hal_buttons_init (hal_button_handler_cb_t cb) |
Initializes the buttons on a DK. More... | |
void | hal_led_pin_set (uint32_t pin, bool value) |
Sets the LED for the given PIN. More... | |
void | hal_led_mask_set (uint32_t led_mask, bool value) |
Sets the LEDs for the given mask. More... | |
bool | hal_led_pin_get (uint32_t pin) |
Gets the current state of a (LED) pin. More... | |
void | hal_led_blink_ms (uint32_t pin_mask, uint32_t delay_ms, uint32_t blink_count) |
Blinks (one toggle cycle) pin_mask a specified number of times. More... | |
void | hal_led_blink_stop (void) |
Stops blinking the LEDs (previously started by hal_led_blink_ms). More... | |
Simple hardware abstraction layer for the example applications.
This module uses GPIOTE driver module. Therefore, GPIOTE_ENABLED
must be set to 1
in the app_config.h
file.
#define HAL_BUTTON_PRESS_DEBOUNCE_INTERVAL MS_TO_US(400) |
Acceptable button press interval in microseconds.
Definition at line 57 of file simple_hal.h.
#define HAL_LED_BLINK_PERIOD_MIN_MS (20) |
Lowest possible blinking period in milliseconds.
Definition at line 60 of file simple_hal.h.
#define LED_MASK_STATE_OFF (false) |
Set LED Mask state to Off.
Definition at line 63 of file simple_hal.h.
#define LED_MASK_STATE_ON (true) |
Set LED Mask state to On.
Definition at line 65 of file simple_hal.h.
#define BUTTON_BOARD |
Boards with user buttons.
Definition at line 81 of file simple_hal.h.
typedef void(* hal_button_handler_cb_t) (uint32_t button_number) |
Button event handler callback type.
[in] | button_number | Button number (0-3). |
Definition at line 88 of file simple_hal.h.
void hal_leds_init | ( | void | ) |
Initializes the LEDs.
uint32_t hal_buttons_init | ( | hal_button_handler_cb_t | cb | ) |
Initializes the buttons on a DK.
To use this API, GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
must be set to a value greater than or equal to BUTTONS_NUMBER
in app_config.h
file to support buttons on the DK board.
[in] | cb | Button event callback. |
NRF_SUCCESS | Successfully initialized buttons. |
NRF_ERROR_NULL | Callback was NULL. |
NRF_ERROR_NOT_SUPPORTED | Buttons not supported for this board. |
void hal_led_pin_set | ( | uint32_t | pin, |
bool | value | ||
) |
Sets the LED for the given PIN.
[in] | pin | LED pin number. |
[in] | value | true for on, false for off. |
void hal_led_mask_set | ( | uint32_t | led_mask, |
bool | value | ||
) |
Sets the LEDs for the given mask.
[in] | led_mask | Mask of LED pins to set/clear. |
[in] | value | true for on, false for off. |
bool hal_led_pin_get | ( | uint32_t | pin | ) |
Gets the current state of a (LED) pin.
[in] | pin | Pin to get state of. |
true
if the LED is on, false
otherwise. void hal_led_blink_ms | ( | uint32_t | pin_mask, |
uint32_t | delay_ms, | ||
uint32_t | blink_count | ||
) |
Blinks (one toggle cycle) pin_mask a specified number of times.
delay_ms
is less than HAL_LED_BLINK_PERIOD_MIN_MS or blink_count
is zero, the call will be ignored. [in] | pin_mask | Mask of LED pins. |
[in] | delay_ms | Delay in milliseconds between each state change. |
[in] | blink_count | Number of times to blink. |
void hal_led_blink_stop | ( | void | ) |
Stops blinking the LEDs (previously started by hal_led_blink_ms).