Practical Robotics Modular Robot Library
Diff: serialcomms.h
- Revision:
- 4:c2e933d53bea
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serialcomms.h Mon Jan 02 15:17:22 2017 +0000 @@ -0,0 +1,39 @@ +#ifndef SERIAL_H +#define SERIAL_H + + +/** + * The SerialComms class contains the functions to read from the robots sensors + */ +class SerialComms +{ +public: + + /** + * Setup the serial interfaces (pc, bt) at the correct baud rate and attach listeners + */ + void setup_serial_interfaces( void ); + + void handle_command_serial_message(char message [3], char interface); + void handle_user_serial_message(char * message, char length, char interface); + float decode_float(char byte0, char byte1); + float decode_float(char byte0); + float decode_unsigned_float(char byte0, char byte1); + float decode_unsigned_float(char byte0); + + // Private functions + private: + + + char * _nibble_to_binary_char(char in); + char * _char_to_binary_char(char in); + void _pc_rx_callback( void ); + void _pc_rx_command_timeout( void ); + + void _bt_rx_callback( void ); + +}; + + +#endif +