diff options
Diffstat (limited to 'app.cpp')
-rw-r--r-- | app.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +#include "app.h" + +#include <HardwareSerial.h> + +// http://bleaklow.com/2010/09/05/progmem_and_gcc_bug_34734.html +#undef PROGMEM +#define PROGMEM __attribute__((section(".progmem.data"))) + +#define GAUGE_COUNT 4 + +// See http://redbearlab.com/blendmicro/ +int gauge_pins[GAUGE_COUNT] = { + 9, 10, 11, 13 +}; + +void on_gauge_data(uint8_t *data, uint8_t len) { + Serial.print(F("on_gauge_data, channel=")); + Serial.print(data[0], HEX); + Serial.print(F(", data[1]=")); + Serial.println(data[1], HEX); +} + +void on_gauge_ctrl(uint8_t *data, uint8_t len) { + Serial.print(F("on_gauge_data, data[0]=")); + Serial.print(data[0], HEX); + Serial.print(F(", data[1]=")); + Serial.println(data[1], HEX); + + uint8_t res[2]; + + switch(data[0]) { + case FSP_CMD_GAUGE_COUNT: + res[0] = FSP_CMD_GAUGE_COUNT; + res[1] = GAUGE_COUNT; + send_ctrl(res, 2); + break; + default: + break; + } +} + |