Practical Robotics Modular Robot Library
serialcomms.h@6:732aa91eb555, 2017-01-13 (annotated)
- Committer:
- jah128
- Date:
- Fri Jan 13 23:16:23 2017 +0000
- Revision:
- 6:732aa91eb555
- Parent:
- 4:c2e933d53bea
Updated;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jah128 | 4:c2e933d53bea | 1 | #ifndef SERIAL_H |
jah128 | 4:c2e933d53bea | 2 | #define SERIAL_H |
jah128 | 4:c2e933d53bea | 3 | |
jah128 | 4:c2e933d53bea | 4 | |
jah128 | 4:c2e933d53bea | 5 | /** |
jah128 | 4:c2e933d53bea | 6 | * The SerialComms class contains the functions to read from the robots sensors |
jah128 | 4:c2e933d53bea | 7 | */ |
jah128 | 4:c2e933d53bea | 8 | class SerialComms |
jah128 | 4:c2e933d53bea | 9 | { |
jah128 | 4:c2e933d53bea | 10 | public: |
jah128 | 4:c2e933d53bea | 11 | |
jah128 | 4:c2e933d53bea | 12 | /** |
jah128 | 4:c2e933d53bea | 13 | * Setup the serial interfaces (pc, bt) at the correct baud rate and attach listeners |
jah128 | 4:c2e933d53bea | 14 | */ |
jah128 | 4:c2e933d53bea | 15 | void setup_serial_interfaces( void ); |
jah128 | 4:c2e933d53bea | 16 | |
jah128 | 4:c2e933d53bea | 17 | void handle_command_serial_message(char message [3], char interface); |
jah128 | 4:c2e933d53bea | 18 | void handle_user_serial_message(char * message, char length, char interface); |
jah128 | 4:c2e933d53bea | 19 | float decode_float(char byte0, char byte1); |
jah128 | 4:c2e933d53bea | 20 | float decode_float(char byte0); |
jah128 | 4:c2e933d53bea | 21 | float decode_unsigned_float(char byte0, char byte1); |
jah128 | 4:c2e933d53bea | 22 | float decode_unsigned_float(char byte0); |
jah128 | 4:c2e933d53bea | 23 | |
jah128 | 4:c2e933d53bea | 24 | // Private functions |
jah128 | 4:c2e933d53bea | 25 | private: |
jah128 | 4:c2e933d53bea | 26 | |
jah128 | 4:c2e933d53bea | 27 | |
jah128 | 4:c2e933d53bea | 28 | char * _nibble_to_binary_char(char in); |
jah128 | 4:c2e933d53bea | 29 | char * _char_to_binary_char(char in); |
jah128 | 4:c2e933d53bea | 30 | void _pc_rx_callback( void ); |
jah128 | 4:c2e933d53bea | 31 | void _pc_rx_command_timeout( void ); |
jah128 | 4:c2e933d53bea | 32 | |
jah128 | 4:c2e933d53bea | 33 | void _bt_rx_callback( void ); |
jah128 | 4:c2e933d53bea | 34 | |
jah128 | 4:c2e933d53bea | 35 | }; |
jah128 | 4:c2e933d53bea | 36 | |
jah128 | 4:c2e933d53bea | 37 | |
jah128 | 4:c2e933d53bea | 38 | #endif |
jah128 | 4:c2e933d53bea | 39 |