ducky's telemetry library

Revision:
0:aaa75ea6d346
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telemetry-mbed-hal.cpp	Tue Mar 31 19:56:00 2015 +0000
@@ -0,0 +1,39 @@
+/*
+ * telemetry-mbedo-hal.cpp
+ *
+ *  Created on: Mar 4, 2015
+ *      Author: Ducky
+ *
+ * Telemetry HAL for Serial on mBed.
+ */
+
+#ifdef __ARMCC_VERSION
+
+#include "telemetry-mbed.h"
+
+namespace telemetry {
+
+void MbedHal::transmit_byte(uint8_t data) {
+  // TODO: optimize with DMA
+  serial.putc(data);
+}
+
+size_t MbedHal::rx_available() {
+  return serial.rxBufferGetCount();
+}
+
+uint8_t MbedHal::receive_byte() {
+  return serial.getc();
+}
+
+void MbedHal::do_error(const char* msg) {
+  serial.printf("%s\r\n", msg);
+}
+
+uint32_t MbedHal::get_time_ms() {
+  return timer.read_ms();
+}
+
+}
+
+#endif // ifdef MBED