Practical Robotics Modular Robot Library

Dependents:   ModularRobot

Revision:
1:a6728adaf7e7
Parent:
0:8a2dd255c508
Child:
2:bf34b86aa0f3
--- a/robot.h	Sat Nov 26 17:28:53 2016 +0000
+++ b/robot.h	Sat Nov 26 21:43:52 2016 +0000
@@ -12,6 +12,28 @@
 #define LED_ADDRESS 0xC0
 #define ADC_ADDRESS 0x90
 
+// SERIAL INTERFACES SETTINGS 
+
+/* ENABLE_BLUETOOTH [1=on, 0=off]:  Enable if the BlueSmirf module is being used */
+/** @brief Enable if the BlueSmirf module is being used. 0=off 1=on*/
+#define ENABLE_BLUETOOTH 1
+
+/* ENABLE_PC_SERIAL [1=on, 0=off]:  Enable if the PC(RPi) USB serial module is being used */
+#define ENABLE_PC_SERIAL 1
+
+/* BLUETOOTH_BAUD [recommended=115200]:  Baud rate for the BlueSMIRF module */
+#define BLUETOOTH_BAUD 115200
+
+/* PC_BAUD [recommended=460800 for optimal performance, 115200 for compatability]:  Baud rate for the PC USB serial module */
+//#define PC_BAUD 460800
+#define PC_BAUD 115200
+
+/* DEBUG_MODE [1=on, 0=off]:  Enable to allow debug messages to be sent of one of the serial interfaces */
+#define DEBUG_MODE 1
+
+/* DEBUG_OUTPUT_STREAM [1=PC\USB 2=BlueSmirf 4=Display]:  Specify which output stream(s) should be used by default for debug messages, if enabled*/
+#define DEBUG_OUTPUT_STREAM 1
+
 // To update sensors 10 times a second (8 x 0.0125 = 0.1)
 #define SENSOR_TICKER_PERIOD 0.0125
 
@@ -30,6 +52,9 @@
 extern Motors motors;
 extern volatile char i2c_lock;
 
+/**
+ *  The Robot class contains the core functions for the robot
+ */
 class Robot
 {
 public:
@@ -57,8 +82,20 @@
      */
     float get_battery_voltage(void);
     
+    /**
+     * Display a string message (printf) on the selected debug output stream [eg pc, bt or both]
+     */
+    void debug(const char* format, ...);
+    
+    /**
+     * Setup the serial interfaces (pc, bt) at the correct baud rate and attach listeners
+     */
+    void setup_serial_interfaces(void);
+    
     private:
     void _update_minutes(void);
+    void _bt_rx_callback(void);
+    void _pc_rx_callback(void);
 };