summaryrefslogtreecommitdiff
path: root/app.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app.cpp')
-rw-r--r--app.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/app.cpp b/app.cpp
new file mode 100644
index 0000000..8163ad8
--- /dev/null
+++ b/app.cpp
@@ -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;
+ }
+}
+