Fork of serial_connected_mcu by tarou yamada

Revision:
3:c927b60f053c
Child:
4:1323ef48a984
diff -r 9d7a03c79cd3 -r c927b60f053c serial_connected_mcu_slave.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serial_connected_mcu_slave.hpp	Sun Jul 10 06:53:44 2016 +0000
@@ -0,0 +1,46 @@
+#ifndef SERIAL_CONNECTED_MCU_SLAVE_
+#define SERIAL_CONNECTED_MCU_SLAVE_
+ 
+#include "mbed.h"
+#include <stdint.h>
+#include <string>
+#include <stdlib.h>
+#include <sstream>
+ 
+namespace serial_connected_mcu{
+    enum{
+       ESC1,
+       ESC2,
+       ESC3,
+       SIZE_OF_READ_DATA
+    };
+    
+    enum{
+        ENCODER1,
+        ENCODER2,
+        ENCODER3,
+        POTENTIONMETER1,
+        POTENTIONMETER2,
+        POTENTIONMETER3,
+        SIZE_OF_WRITE_DATA
+    };
+ 
+    class serial_connected_mcu_slave{
+    public:
+        serial_connected_mcu_slave();
+        ~serial_connected_mcu_slave();
+        void set(int index_of_data, int16_t setting_data);
+        int16_t get(int index_of_data);
+    private:
+        static const PinName PIN_SERIAL_TX = SERIAL_TX;
+        static const PinName PIN_SERIAL_RX = SERIAL_RX;
+        static const int BAUDRATE = 9600;
+        int16_t* array_of_read_data;
+        int16_t* array_of_write_data;
+        std::string received_buffer;
+        Serial* port;
+        bool is_locking;
+        void on_received();
+        void string_to_int();
+    };
+}
\ No newline at end of file