first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
rs422_put.h@1:dd594521d6e2, 2017-09-24 (annotated)
- Committer:
- echo_piyo
- Date:
- Sun Sep 24 06:18:58 2017 +0000
- Revision:
- 1:dd594521d6e2
- Parent:
- 0:2365b54fd0db
2??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
echo_piyo | 0:2365b54fd0db | 1 | /*************** |
echo_piyo | 0:2365b54fd0db | 2 | RS422 master libraly |
echo_piyo | 0:2365b54fd0db | 3 | |
echo_piyo | 0:2365b54fd0db | 4 | RS422 name(tx, rx) |
echo_piyo | 0:2365b54fd0db | 5 | tx : mbed_tx |
echo_piyo | 0:2365b54fd0db | 6 | rx : mbed_rx |
echo_piyo | 0:2365b54fd0db | 7 | |
echo_piyo | 0:2365b54fd0db | 8 | put(int id, float m1_duty, float m2_duty) |
echo_piyo | 0:2365b54fd0db | 9 | id : NucleoのID 0~31 |
echo_piyo | 0:2365b54fd0db | 10 | duty : モータにかけるPWMのDuty -1.0~1.0 |
echo_piyo | 0:2365b54fd0db | 11 | |
echo_piyo | 0:2365b54fd0db | 12 | ****************/ |
echo_piyo | 0:2365b54fd0db | 13 | |
echo_piyo | 0:2365b54fd0db | 14 | #ifndef MBED_RS422_PUT_H |
echo_piyo | 0:2365b54fd0db | 15 | #define MBED_RS422_PUT_H |
echo_piyo | 0:2365b54fd0db | 16 | |
echo_piyo | 0:2365b54fd0db | 17 | #include "mbed.h" |
echo_piyo | 0:2365b54fd0db | 18 | |
echo_piyo | 0:2365b54fd0db | 19 | #define start_signal 0b11111111 |
echo_piyo | 0:2365b54fd0db | 20 | #define wait_time 0.0005 |
echo_piyo | 0:2365b54fd0db | 21 | |
echo_piyo | 1:dd594521d6e2 | 22 | |
echo_piyo | 0:2365b54fd0db | 23 | class Rs422 |
echo_piyo | 0:2365b54fd0db | 24 | { |
echo_piyo | 0:2365b54fd0db | 25 | public : |
echo_piyo | 0:2365b54fd0db | 26 | Rs422(PinName mbed_tx, PinName mbed_rx); |
echo_piyo | 0:2365b54fd0db | 27 | |
echo_piyo | 0:2365b54fd0db | 28 | void begin(int baudrate); |
echo_piyo | 0:2365b54fd0db | 29 | |
echo_piyo | 0:2365b54fd0db | 30 | void put(short id, float m1_duty, float m2_duty); |
echo_piyo | 0:2365b54fd0db | 31 | |
echo_piyo | 0:2365b54fd0db | 32 | private : |
echo_piyo | 0:2365b54fd0db | 33 | Serial RS422; |
echo_piyo | 0:2365b54fd0db | 34 | Ticker timer; |
echo_piyo | 0:2365b54fd0db | 35 | |
echo_piyo | 0:2365b54fd0db | 36 | short flag; |
echo_piyo | 0:2365b54fd0db | 37 | int counter; |
echo_piyo | 0:2365b54fd0db | 38 | int m1_data,m2_data,check_sum; |
echo_piyo | 0:2365b54fd0db | 39 | int ID; |
echo_piyo | 0:2365b54fd0db | 40 | |
echo_piyo | 0:2365b54fd0db | 41 | void put_time(); |
echo_piyo | 0:2365b54fd0db | 42 | }; |
echo_piyo | 0:2365b54fd0db | 43 | |
echo_piyo | 0:2365b54fd0db | 44 | #endif |