mirror of https://gerrit.osmocom.org/simtrace2
LED: add short LED pulse blinking pattern
Change-Id: I0fdc2f902a3b92da6aa9b9c8500abae8a2f79447
This commit is contained in:
parent
10553e7f0c
commit
8fd88b8a59
|
@ -13,9 +13,10 @@ enum led_pattern {
|
||||||
BLINK_3O_30F = 3,
|
BLINK_3O_30F = 3,
|
||||||
BLINK_3O_1F_3O_30F = 4,
|
BLINK_3O_1F_3O_30F = 4,
|
||||||
BLINK_3O_1F_3O_1F_3O_30F= 5,
|
BLINK_3O_1F_3O_1F_3O_30F= 5,
|
||||||
BLINK_200O_F = 6,
|
BLINK_2O_F = 6,
|
||||||
BLINK_600O_F = 7,
|
BLINK_200O_F = 7,
|
||||||
BLINK_CUSTOM = 8,
|
BLINK_600O_F = 8,
|
||||||
|
BLINK_CUSTOM = 9,
|
||||||
_NUM_LED_BLINK
|
_NUM_LED_BLINK
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ static void led_set(enum led led, int on)
|
||||||
ASSERT(led < PIO_LISTSIZE(pinsLeds));
|
ASSERT(led < PIO_LISTSIZE(pinsLeds));
|
||||||
|
|
||||||
if (on)
|
if (on)
|
||||||
PIO_Set(&pinsLeds[led]);
|
|
||||||
else
|
|
||||||
PIO_Clear(&pinsLeds[led]);
|
PIO_Clear(&pinsLeds[led]);
|
||||||
|
else
|
||||||
|
PIO_Set(&pinsLeds[led]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LED blinking code */
|
/* LED blinking code */
|
||||||
|
@ -27,7 +27,7 @@ static void led_set(enum led led, int on)
|
||||||
struct blink_state {
|
struct blink_state {
|
||||||
/* duration of the state in ms */
|
/* duration of the state in ms */
|
||||||
uint16_t duration;
|
uint16_t duration;
|
||||||
/* bringhtness of LED during the state */
|
/* brightness of LED during the state */
|
||||||
uint8_t on;
|
uint8_t on;
|
||||||
} __attribute__((packed));
|
} __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[] = {
|
static const struct blink_state bs_3on_1off_3on_1off_3on_30off[] = {
|
||||||
{ 300, 1 }, { 100, 0 }, { 300, 1 }, { 100, 0 }, { 300, 1 }, { 3000, 0 }
|
{ 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[] = {
|
static const struct blink_state bs_200on_off[] = {
|
||||||
{ 20000, 1 }, { 0, 0 },
|
{ 20000, 1 }, { 0, 0 },
|
||||||
};
|
};
|
||||||
|
@ -94,6 +97,10 @@ static const struct blink_pattern patterns[] = {
|
||||||
.states = bs_3on_1off_3on_1off_3on_30off,
|
.states = bs_3on_1off_3on_1off_3on_30off,
|
||||||
.size = ARRAY_SIZE(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] = {
|
[BLINK_200O_F] = {
|
||||||
.states = bs_200on_off,
|
.states = bs_200on_off,
|
||||||
.size = ARRAY_SIZE(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[] = {
|
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_RED] = {
|
||||||
.led = LED_RED,
|
.led = LED_RED,
|
||||||
.timer.cb = blink_tmr_cb,
|
.timer.cb = blink_tmr_cb,
|
||||||
.timer.data = &led_state[LED_RED],
|
.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 */
|
#endif /* PINS_LEDS */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue