1 #include "Pulsecounter.h"
4 static void gpioHandler(uint8_t id);
5 static void tickHandler(void);
6 static int32_t cold = 0;
7 static int32_t hot = 0;
8 static bool connected = false;
12 Hal_gpioEnable(gpioHandler);
13 Pulsecounter_setDeviceName("PULS-CNTR");
18 static void blink(uint8_t which, uint8_t count) {
20 for (i = 0; i < count; i++) {
22 if (which & 1) Hal_greenLedOn();
23 if (which & 2) Hal_redLedOn();
25 if (which & 1) Hal_greenLedOff();
26 if (which & 2) Hal_redLedOff();
30 static void gpioHandler(uint8_t id) {
35 /* Pulsecounter_accept(true); */
37 Pulsecounter_coldTick_indicate();
39 Pulsecounter_hotTick_indicate();
42 Hal_tickStart(15000, tickHandler);
47 Pulsecounter_coldTick_indicate();
53 Pulsecounter_hotTick_indicate();
61 static void tickHandler(void) {
67 for (i = 0; i < 3; i++) {
76 /* Pulsecounter_accept(false); */
79 /* -------- SCHEMA CALLBACKS -------- */
81 void Pulsecounter_connectHandler(void) {
87 void Pulsecounter_disconnectHandler(void) {
89 /* Hal_tickStart(15000, tickHandler); */
94 void Pulsecounter_coldTick_fetch(Pulsecounter_coldTick_t* const output) {
98 void Pulsecounter_hotTick_fetch(Pulsecounter_hotTick_t* const output) {