mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
LED: add short LED pulse blinking pattern
Change-Id: I0fdc2f902a3b92da6aa9b9c8500abae8a2f79447
This commit is contained in:
@@ -13,9 +13,10 @@ enum led_pattern {
|
||||
BLINK_3O_30F = 3,
|
||||
BLINK_3O_1F_3O_30F = 4,
|
||||
BLINK_3O_1F_3O_1F_3O_30F= 5,
|
||||
BLINK_200O_F = 6,
|
||||
BLINK_600O_F = 7,
|
||||
BLINK_CUSTOM = 8,
|
||||
BLINK_2O_F = 6,
|
||||
BLINK_200O_F = 7,
|
||||
BLINK_600O_F = 8,
|
||||
BLINK_CUSTOM = 9,
|
||||
_NUM_LED_BLINK
|
||||
};
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ static void led_set(enum led led, int on)
|
||||
struct blink_state {
|
||||
/* duration of the state in ms */
|
||||
uint16_t duration;
|
||||
/* bringhtness of LED during the state */
|
||||
/* brightness of LED during the state */
|
||||
uint8_t on;
|
||||
} __attribute__((packed));
|
||||
|
||||
@@ -54,6 +54,9 @@ static const struct blink_state bs_3on_1off_3on_30off[] = {
|
||||
static const struct blink_state bs_3on_1off_3on_1off_3on_30off[] = {
|
||||
{ 300, 1 }, { 100, 0 }, { 300, 1 }, { 100, 0 }, { 300, 1 }, { 3000, 0 }
|
||||
};
|
||||
static const struct blink_state bs_2on_off[] = {
|
||||
{ 200, 1 }, { 0, 0 },
|
||||
};
|
||||
static const struct blink_state bs_200on_off[] = {
|
||||
{ 20000, 1 }, { 0, 0 },
|
||||
};
|
||||
@@ -94,6 +97,10 @@ static const struct blink_pattern patterns[] = {
|
||||
.states = bs_3on_1off_3on_1off_3on_30off,
|
||||
.size = ARRAY_SIZE(bs_3on_1off_3on_1off_3on_30off),
|
||||
},
|
||||
[BLINK_2O_F] = {
|
||||
.states = bs_2on_off,
|
||||
.size = ARRAY_SIZE(bs_2on_off),
|
||||
},
|
||||
[BLINK_200O_F] = {
|
||||
.states = bs_200on_off,
|
||||
.size = ARRAY_SIZE(bs_200on_off),
|
||||
@@ -158,16 +165,16 @@ static void blink_tmr_cb(void *data)
|
||||
}
|
||||
|
||||
static struct led_state led_state[] = {
|
||||
[LED_GREEN] = {
|
||||
.led = LED_GREEN,
|
||||
.timer.cb = blink_tmr_cb,
|
||||
.timer.data = &led_state[LED_GREEN],
|
||||
},
|
||||
[LED_RED] = {
|
||||
.led = LED_RED,
|
||||
.timer.cb = blink_tmr_cb,
|
||||
.timer.data = &led_state[LED_RED],
|
||||
},
|
||||
[LED_GREEN] = {
|
||||
.led = LED_GREEN,
|
||||
.timer.cb = blink_tmr_cb,
|
||||
.timer.data = &led_state[LED_GREEN],
|
||||
},
|
||||
};
|
||||
#endif /* PINS_LEDS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user