X-Git-Url: http://www.average.org/gitweb/?p=pulsecounter.git;a=blobdiff_plain;f=Pulsecounter-Prog.c;h=107ad32c2aae86362ed29fa7c62628031cbefbb4;hp=331dbf5366af78b29b9d5f79612c5b24d8132704;hb=7777d9668d46c0c5de8969490ecc0c7917f69f92;hpb=440f8b92b68c9829d1b9ccf274db5f53fb4e0de7 diff --git a/Pulsecounter-Prog.c b/Pulsecounter-Prog.c index 331dbf5..107ad32 100644 --- a/Pulsecounter-Prog.c +++ b/Pulsecounter-Prog.c @@ -4,10 +4,8 @@ static void gpioHandler(uint8_t id); static void tickHandler(void); static bool connected = false; -static int32_t base4 = 0; -static int32_t base5 = 0; -static int32_t event4 = 0; -static int32_t event5 = 0; +static int32_t cold = 0; +static int32_t hot = 0; void main() { Hal_init(); @@ -28,20 +26,20 @@ static void gpioHandler(uint8_t id) { Hal_delay(10); Hal_greenLedOff(); Hal_redLedOff(); - Hal_tickStart(5000, tickHandler); + Hal_tickStart(15000, tickHandler); break; case 1: - event4++; + cold++; if (connected) - Pulsecounter_event4_indicate(); + Pulsecounter_coldTick_indicate(); Hal_greenLedOn(); Hal_delay(10); Hal_greenLedOff(); break; case 2: - event5++; + hot++; if (connected) - Pulsecounter_event5_indicate(); + Pulsecounter_hotTick_indicate(); Hal_redLedOn(); Hal_delay(10); Hal_redLedOff(); @@ -97,30 +95,22 @@ void Pulsecounter_disconnectHandler(void) { Hal_redLedOn(); Hal_delay(100); Hal_redLedOff(); - Hal_tickStart(5000, tickHandler); + Hal_tickStart(15000, tickHandler); Hal_disconnected(); } -void Pulsecounter_event4_fetch(Pulsecounter_event4_t* const output) { - *output = base4 + event4; +void Pulsecounter_coldTick_fetch(Pulsecounter_coldTick_t* const output) { + *output = cold; } -void Pulsecounter_event5_fetch(Pulsecounter_event5_t* const output) { - *output = base5 + event5; +void Pulsecounter_hotTick_fetch(Pulsecounter_hotTick_t* const output) { + *output = hot; } -void Pulsecounter_base4_fetch(Pulsecounter_base4_t* const output) { - *output = base4; +void Pulsecounter_coldSet_store(Pulsecounter_coldSet_t* const input) { + cold = *input; } -void Pulsecounter_base4_store(Pulsecounter_base4_t* const input) { - base4 = *input - event4; -} - -void Pulsecounter_base5_fetch(Pulsecounter_base5_t* const output) { - *output = base5; -} - -void Pulsecounter_base5_store(Pulsecounter_base5_t* const input) { - base5 = *input - event5; +void Pulsecounter_hotSet_store(Pulsecounter_hotSet_t* const input) { + hot = *input; }