mirror of
https://wiki.pbeirne.com/patb/cmt.git
synced 2026-12-03 12:05:20 -05:00
changed all timers to count-down, prose cleanup
This commit is contained in:
@@ -127,13 +127,13 @@ void respondToButtonTask(uint8 evt) {
|
||||
case RTB_IDLE:
|
||||
if (evt == EVT_BUTTON) {
|
||||
rtbState = RTB_ON;
|
||||
rtbTimerCount = 0;
|
||||
rtbTimerCount = BUTTON_LED_ON_TIME;
|
||||
gpio_set(LED, LED_ON);
|
||||
}
|
||||
break;
|
||||
case RTB_ON:
|
||||
if (evt == EVT_TICK) {
|
||||
if (++rtbTimerCount > BUTTON_LED_ON_TIME) {
|
||||
if (--rtbTimerCount == 0) {
|
||||
gpio_set(LED, LED_OFF);
|
||||
rtbState = RTB_IDLE;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void respondToButtonTask(uint8 evt) {
|
||||
|
||||
const int LED_ON_TIME = 150;
|
||||
const int LED_OFF_TIME = 50;
|
||||
static uint8 ledState = LED_OFF;
|
||||
static uint8 ledState = LED_OFF;
|
||||
static uint16 ledTimerCount = 0;
|
||||
|
||||
void ledTask(uint8 evt) {
|
||||
@@ -153,14 +153,14 @@ void ledTask(uint8 evt) {
|
||||
if (evt == EVT_TICK) {
|
||||
if (++ledTimerCount > LED_OFF_TIME) {
|
||||
gpio_set(LED2, LED_ON);
|
||||
ledTimerCount = 0;
|
||||
ledTimerCount = LED_ON_TIME;
|
||||
ledState = LED_ON;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LED_ON:
|
||||
if (evt == EVT_TICK) {
|
||||
if (++ledTimerCount > LED_ON_TIME) {
|
||||
if (--ledTimerCount == 0) {
|
||||
gpio_set(LED2, LED_OFF);
|
||||
ledTimerCount = 0;
|
||||
ledState = LED_OFF;
|
||||
|
||||
Reference in New Issue
Block a user