E=MC / telemetry

Dependents:   figure_eight

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers telemetry-arduino-hal.cpp Source File

telemetry-arduino-hal.cpp

00001 /*
00002  * telemetry-arduino-hal.cpp
00003  *
00004  *  Created on: Mar 2, 2015
00005  *      Author: Ducky
00006  *
00007  * Telemetry HAL for Serial on Arduino.
00008  */
00009 
00010 #ifdef ARDUINO
00011 
00012 #include "telemetry-arduino.h"
00013 
00014 namespace telemetry {
00015 
00016 void ArduinoHalInterface::transmit_byte(uint8_t data) {
00017   serial.write(data);
00018 }
00019 
00020 size_t ArduinoHalInterface::rx_available() {
00021   return serial.available();
00022 }
00023 
00024 uint8_t ArduinoHalInterface::receive_byte() {
00025   // TODO: handle -1 case
00026   return serial.read();
00027 }
00028 
00029 void ArduinoHalInterface::do_error(const char* msg) {
00030   // TODO: use side channel?
00031   serial.println(msg);
00032 }
00033 
00034 }
00035 
00036 #endif // ifdef ARDUINO