Simple hardware abstraction layer for the example applications.
More...
Simple hardware abstraction layer for the example applications.
◆ HAL_BUTTON_PRESS_FREQUENCY
#define HAL_BUTTON_PRESS_FREQUENCY HAL_MS_TO_RTC_TICKS(400) |
Acceptable button press frequency in RTC ticks.
Definition at line 53 of file simple_hal.h.
◆ HAL_LED_BLINK_PERIOD_MIN_MS
#define HAL_LED_BLINK_PERIOD_MIN_MS (20) |
Lowest possible blinking period in milliseconds.
Definition at line 56 of file simple_hal.h.
◆ LED_MASK_STATE_OFF
#define LED_MASK_STATE_OFF (false) |
Set LED Mask state to Off.
Definition at line 59 of file simple_hal.h.
◆ LED_MASK_STATE_ON
#define LED_MASK_STATE_ON (true) |
◆ hal_button_handler_cb_t
typedef void(* hal_button_handler_cb_t) (uint32_t button_number) |
Button event handler callback type.
- Parameters
-
[in] | button_number | Button number (0-3). |
Definition at line 71 of file simple_hal.h.
◆ hal_leds_init()
void hal_leds_init |
( |
void |
| ) |
|
◆ hal_buttons_init()
Initializes the buttons on a DK.
- Parameters
-
[in] | cb | Button event callback. |
- Return values
-
NRF_SUCCESS | Successfully initialized buttons. |
NRF_ERROR_NULL | Callback was NULL. |
NRF_ERROR_NOT_SUPPORTED | Buttons not supported for this board. |
◆ hal_led_pin_set()
void hal_led_pin_set |
( |
uint32_t |
pin, |
|
|
bool |
value |
|
) |
| |
Sets the LED for the given PIN.
- Parameters
-
[in] | pin | LED pin number. |
[in] | value | true for on, false for off. |
◆ hal_led_mask_set()
void hal_led_mask_set |
( |
uint32_t |
led_mask, |
|
|
bool |
value |
|
) |
| |
Sets the LEDs for the given mask.
- Parameters
-
[in] | led_mask | Mask of LED pins to set/clear. |
[in] | value | true for on, false for off. |
◆ hal_led_pin_get()
bool hal_led_pin_get |
( |
uint32_t |
pin | ) |
|
Gets the current state of a (LED) pin.
- Note
- The LEDs are active low, i.e., on when it's GPIO is set low.
- Parameters
-
[in] | pin | Pin to get state of. |
- Returns
true
if the LED is on, false
otherwise.
◆ hal_led_blink_ms()
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.
- Note
- If the API is called twice, the blink sequence is reset.
-
If
delay_ms
is less than HAL_LED_BLINK_PERIOD_MIN_MS or blink_count
is zero, the call will be ignored.
-
If the APP_TIMER queue is full, this call may fail silently.
- Parameters
-
[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. |
◆ hal_led_blink_stop()
void hal_led_blink_stop |
( |
void |
| ) |
|