1 #include "Pulsecounter.h"
4 static void settleHandler(uint8_t id);
5 static void jitterHandler(uint8_t id, uint32_t count);
6 static int32_t cold = 0;
7 static int32_t hot = 0;
8 static int32_t coldJ = 0;
9 static int32_t hotJ = 0;
10 static bool connected = false;
14 Hal_gpioEnable(settleHandler, jitterHandler);
15 Pulsecounter_setDeviceName("PULS-CNTR");
20 static void blink(uint8_t which, uint8_t count) {
22 for (i = 0; i < count; i++) {
24 if (which & 1) Hal_greenLedOn();
25 if (which & 2) Hal_redLedOn();
27 if (which & 1) Hal_greenLedOff();
28 if (which & 2) Hal_redLedOff();
32 static void settleHandler(uint8_t id) {
35 /* Pulsecounter_accept(true); */
37 Pulsecounter_coldTick_indicate();
39 Pulsecounter_hotTick_indicate();
46 Pulsecounter_coldTick_indicate();
52 Pulsecounter_hotTick_indicate();
60 static void jitterHandler(uint8_t id, uint32_t count) {
68 Pulsecounter_coldJitter_indicate();
74 Pulsecounter_hotJitter_indicate();
82 /* -------- SCHEMA CALLBACKS -------- */
84 void Pulsecounter_connectHandler(void) {
89 void Pulsecounter_disconnectHandler(void) {
94 void Pulsecounter_coldTick_fetch(Pulsecounter_coldTick_t* const output) {
98 void Pulsecounter_hotTick_fetch(Pulsecounter_hotTick_t* const output) {
102 void Pulsecounter_coldJitter_fetch(Pulsecounter_coldJitter_t* output) {
106 void Pulsecounter_hotJitter_fetch(Pulsecounter_hotJitter_t* output) {