明石高専ロボ研 mbedライブラリ
Dependents: MDD_L432KC USB2RS485 pathtracking odometry ... more
Diff: scrp_slave.hpp
- Revision:
- 2:141358d84ff4
- Parent:
- 0:ca84ed7518f5
- Child:
- 3:28c77df7c0b6
diff -r a3157aa0e8ed -r 141358d84ff4 scrp_slave.hpp --- a/scrp_slave.hpp Thu Jan 02 12:55:09 2020 +0000 +++ b/scrp_slave.hpp Fri Jan 03 02:37:48 2020 +0000 @@ -1,7 +1,6 @@ #ifndef SCRP_SLAVE_H #define SCRP_SLAVE_H #include "mbed.h" -#include "BufferedSerial.h" /*USBでPCにつなぐポートと、基板上でRasPiとつなぐポートを同時に開く。 *RedePinの有り無しの選択、ポートを一つだけ開くことも可。 @@ -37,19 +36,29 @@ int16_t send2(uint8_t id,uint8_t cmd,int16_t tx_data); private: DigitalOut *rede_; - BufferedSerial *serial_[2]; + Serial *serial_[2]; FlashIAP *flash_; + uint8_t send_data_[2][8]; uint8_t mode_; uint8_t my_id_; uint32_t address_; int timeout_; + bool wait_data_[2]; + bool stx_flag_[2]; + bool id_ok_[2]; + uint8_t tmp_data_[2][5]; + uint8_t data_count_[2]; + int16_t rx_data_[2]; bool (*procs_[256])(int rx_data, int& tx_data); int16_t sending(int,uint8_t,uint8_t,int16_t); void changeID(uint8_t); + void init(PinName,PinName); void check(int port); - void init(PinName,PinName); void port1(); void port2(); + void data_send1(); + void data_send2(); + void prime(int); }; #endif /* SCRP_SLAVE_H */ \ No newline at end of file