Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ros_lib_kinetic
Diff: library/ScrpSlave.hpp
- Revision:
- 0:a8a56075e947
- Child:
- 1:17051435cfc5
diff -r 000000000000 -r a8a56075e947 library/ScrpSlave.hpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/library/ScrpSlave.hpp Sat May 18 12:09:43 2019 +0000
@@ -0,0 +1,31 @@
+#pragma once
+#include "mbed.h"
+#define constrain(x,a,b) min(max(x,a),b)
+
+class ScrpSlave{
+public:
+ ScrpSlave(PinName TX1,PinName RX1,uint32_t addr);//RedePinなし、1ポート
+ ScrpSlave(PinName TX1,PinName RX1,PinName REDE1,uint32_t addr);//RedePinあり、1ポート
+ ScrpSlave(PinName TX1,PinName RX1,PinName TX2,PinName RX2,uint32_t addr);//RedePinなし、2ポート
+ ScrpSlave(PinName TX1,PinName RX1,PinName REDE1,PinName TX2,PinName RX2,uint32_t addr);//RedePinあり、1ポート+RedePinなし、1ポート
+ ~ScrpSlave();
+ void setTimeout(int);
+ void addCMD(uint8_t cmd, bool (*proc)(int rx_data,int& tx_data));
+ int send(uint8_t id,uint8_t cmd,int16_t tx_data);
+ int send2(uint8_t id,uint8_t cmd,int16_t tx_data);
+private:
+ DigitalOut *rede;
+ Serial *serial[2];
+ FlashIAP *flash;
+ uint8_t mode;
+ uint8_t my_id;
+ uint32_t addr;
+ int timeout;
+ bool (*procs[256])(int rx_data, int& tx_data);
+ int sending(int,uint8_t,uint8_t,int16_t);
+ void changeID(uint8_t);
+ void check(int port);
+ void init(PinName,PinName);
+ void port1();
+ void port2();
+};
\ No newline at end of file