nucleo側のプログラム

Dependents:   serial_connected_mcu_nucleo serial_connected_mcu_nucleo

Fork of serial_connected_mcu by tarou yamada

Committer:
inst
Date:
Sat Jul 30 06:00:59 2016 +0000
Revision:
11:6f8e34a71c7e
Parent:
7:f8dd6ab9ce94
Child:
16:4e310c3f3a2b
?? ENCODER_SPEED

Who changed what in which revision?

UserRevisionLine numberNew contents of line
inst 3:c927b60f053c 1 #ifndef SERIAL_CONNECTED_MCU_SLAVE_
inst 3:c927b60f053c 2 #define SERIAL_CONNECTED_MCU_SLAVE_
inst 3:c927b60f053c 3
inst 3:c927b60f053c 4 #include "mbed.h"
inst 3:c927b60f053c 5 #include <stdint.h>
inst 3:c927b60f053c 6 #include <string>
inst 3:c927b60f053c 7 #include <stdlib.h>
inst 3:c927b60f053c 8 #include <sstream>
inst 3:c927b60f053c 9
inst 3:c927b60f053c 10 namespace serial_connected_mcu{
inst 4:1323ef48a984 11 enum read_id {
inst 3:c927b60f053c 12 ESC1,
inst 3:c927b60f053c 13 ESC2,
inst 3:c927b60f053c 14 ESC3,
inst 3:c927b60f053c 15 SIZE_OF_READ_DATA
inst 3:c927b60f053c 16 };
inst 3:c927b60f053c 17
inst 4:1323ef48a984 18 enum write_id {
inst 11:6f8e34a71c7e 19 ENCODER_SPEED1,
inst 11:6f8e34a71c7e 20 ENCODER_SPEED2,
inst 11:6f8e34a71c7e 21 ENCODER_SPEED3,
inst 3:c927b60f053c 22 ENCODER1,
inst 3:c927b60f053c 23 ENCODER2,
inst 3:c927b60f053c 24 ENCODER3,
inst 3:c927b60f053c 25 POTENTIONMETER1,
inst 3:c927b60f053c 26 POTENTIONMETER2,
inst 3:c927b60f053c 27 POTENTIONMETER3,
inst 3:c927b60f053c 28 SIZE_OF_WRITE_DATA
inst 3:c927b60f053c 29 };
inst 3:c927b60f053c 30
inst 3:c927b60f053c 31 class serial_connected_mcu_slave{
inst 3:c927b60f053c 32 public:
inst 3:c927b60f053c 33 serial_connected_mcu_slave();
inst 3:c927b60f053c 34 ~serial_connected_mcu_slave();
inst 3:c927b60f053c 35 void set(int index_of_data, int16_t setting_data);
inst 3:c927b60f053c 36 int16_t get(int index_of_data);
inst 3:c927b60f053c 37 private:
kachikyun 7:f8dd6ab9ce94 38 static const PinName PIN_SERIAL_TX;
kachikyun 7:f8dd6ab9ce94 39 static const PinName PIN_SERIAL_RX;
inst 3:c927b60f053c 40 static const int BAUDRATE = 9600;
inst 3:c927b60f053c 41 int16_t* array_of_read_data;
inst 3:c927b60f053c 42 int16_t* array_of_write_data;
inst 3:c927b60f053c 43 std::string received_buffer;
inst 3:c927b60f053c 44 Serial* port;
inst 3:c927b60f053c 45 bool is_locking;
inst 3:c927b60f053c 46 void on_received();
inst 3:c927b60f053c 47 void string_to_int();
inst 3:c927b60f053c 48 };
inst 4:1323ef48a984 49 }
inst 4:1323ef48a984 50
inst 4:1323ef48a984 51 #endif