HID Add-on API 1.0.99
Loading...
Searching...
No Matches
led_state_def.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#include "led_state.h"
8#include <caf/led_effect.h>
9
10/* This configuration file is included only once from led_state module and holds
11 * information about LED effect associated with each state.
12 */
13
14/* This structure enforces the header file is included only once in the build.
15 * Violating this requirement triggers a multiple definition error at link time.
16 */
18
19
20/* Map function to LED ID */
21static const uint8_t led_map[LED_ID_COUNT] = {
24};
25
26/* On the nRF54L15 SoC, you can only use the **GPIO1** port for PWM hardware peripheral output.
27 * Because of that, on the DK PCA10156 revision v0.9.3 **LED 0** and **LED 2** cannot be used
28 * for PWM output.
29 *
30 * You can still use these LEDs with the PWM LED driver, but you must set the LED color to
31 * `LED_COLOR(255, 255, 255)` or `LED_COLOR(0, 0, 0)`. You must also disable the
32 * `CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100` Kconfig option. This ensures the PWM peripheral is not used
33 * for the mentioned LEDs.
34 */
35
36static const struct led_effect led_system_state_effect[LED_SYSTEM_STATE_COUNT] = {
37 [LED_SYSTEM_STATE_IDLE] = LED_EFFECT_LED_ON(LED_COLOR(255, 255, 255)),
38 [LED_SYSTEM_STATE_CHARGING] = LED_EFFECT_LED_ON(LED_COLOR(255, 255, 255)),
39 [LED_SYSTEM_STATE_ERROR] = LED_EFFECT_LED_BLINK(200, LED_COLOR(255, 255, 255)),
40};
41
42static const struct led_effect led_peer_state_effect[LED_PEER_COUNT][LED_PEER_STATE_COUNT] = {
43 {[LED_PEER_STATE_DISCONNECTED] = LED_EFFECT_LED_OFF(),
44 [LED_PEER_STATE_CONNECTED] = LED_EFFECT_LED_ON(LED_COLOR(100, 100, 100)),
45 [LED_PEER_STATE_PEER_SEARCH] = LED_EFFECT_LED_BREATH(1000, LED_COLOR(100, 100, 100)),
46 [LED_PEER_STATE_CONFIRM_SELECT] = LED_EFFECT_LED_BLINK(50, LED_COLOR(100, 100, 100)),
47 [LED_PEER_STATE_CONFIRM_ERASE] = LED_EFFECT_LED_BLINK(25, LED_COLOR(100, 100, 100)),
48 [LED_PEER_STATE_ERASE_ADV] = LED_EFFECT_LED_BREATH(100, LED_COLOR(100, 100, 100)),
49 },
50};
@ LED_PEER_STATE_CONNECTED
Definition led_state.h:45
@ LED_PEER_STATE_CONFIRM_ERASE
Definition led_state.h:51
@ LED_PEER_STATE_ERASE_ADV
Definition led_state.h:53
@ LED_PEER_STATE_DISCONNECTED
Definition led_state.h:43
@ LED_PEER_STATE_CONFIRM_SELECT
Definition led_state.h:49
@ LED_PEER_STATE_PEER_SEARCH
Definition led_state.h:47
@ LED_PEER_STATE_COUNT
Definition led_state.h:56
@ LED_SYSTEM_STATE_CHARGING
Definition led_state.h:32
@ LED_SYSTEM_STATE_IDLE
Definition led_state.h:30
@ LED_SYSTEM_STATE_COUNT
Definition led_state.h:37
@ LED_SYSTEM_STATE_ERROR
Definition led_state.h:34
@ LED_ID_COUNT
Definition led_state.h:67
@ LED_ID_SYSTEM_STATE
Definition led_state.h:62
@ LED_ID_PEER_STATE
Definition led_state.h:64
#define LED_PEER_COUNT
Definition led_state.h:80
Header file with LED states.
const struct @10 led_state_def_include_once
static const uint8_t led_map[LED_ID_COUNT]
Definition led_state_def.h:21
static const struct led_effect led_system_state_effect[LED_SYSTEM_STATE_COUNT]
Definition led_state_def.h:36
static const struct led_effect led_peer_state_effect[1][LED_PEER_STATE_COUNT]
Definition led_state_def.h:42