first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
rs422_put.h@0:2365b54fd0db, 2017-09-24 (annotated)
- Committer:
- echo_piyo
- Date:
- Sun Sep 24 05:24:26 2017 +0000
- Revision:
- 0:2365b54fd0db
- Child:
- 1:dd594521d6e2
????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 | 0:2365b54fd0db | 22 | class Rs422 |
echo_piyo | 0:2365b54fd0db | 23 | { |
echo_piyo | 0:2365b54fd0db | 24 | public : |
echo_piyo | 0:2365b54fd0db | 25 | Rs422(PinName mbed_tx, PinName mbed_rx); |
echo_piyo | 0:2365b54fd0db | 26 | |
echo_piyo | 0:2365b54fd0db | 27 | void begin(int baudrate); |
echo_piyo | 0:2365b54fd0db | 28 | |
echo_piyo | 0:2365b54fd0db | 29 | void put(short id, float m1_duty, float m2_duty); |
echo_piyo | 0:2365b54fd0db | 30 | |
echo_piyo | 0:2365b54fd0db | 31 | private : |
echo_piyo | 0:2365b54fd0db | 32 | Serial RS422; |
echo_piyo | 0:2365b54fd0db | 33 | Ticker timer; |
echo_piyo | 0:2365b54fd0db | 34 | |
echo_piyo | 0:2365b54fd0db | 35 | short flag; |
echo_piyo | 0:2365b54fd0db | 36 | int counter; |
echo_piyo | 0:2365b54fd0db | 37 | int m1_data,m2_data,check_sum; |
echo_piyo | 0:2365b54fd0db | 38 | int ID; |
echo_piyo | 0:2365b54fd0db | 39 | |
echo_piyo | 0:2365b54fd0db | 40 | void put_time(); |
echo_piyo | 0:2365b54fd0db | 41 | }; |
echo_piyo | 0:2365b54fd0db | 42 | |
echo_piyo | 0:2365b54fd0db | 43 | #endif |