RMD-X Motor Library - Last Update V0.5 - On going...... Current available Function - read velocity - read all data - send velocity - send position
RMD.h@20:0756a01f7415, 2020-12-19 (annotated)
- Committer:
- sornpraram
- Date:
- Sat Dec 19 08:43:14 2020 +0000
- Revision:
- 20:0756a01f7415
- Parent:
- 13:09e4446b41cc
Final V0.5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sornpraram | 0:433e4ec5de88 | 1 | #ifndef RMD_H |
sornpraram | 0:433e4ec5de88 | 2 | #define RMD_H |
sornpraram | 0:433e4ec5de88 | 3 | |
sornpraram | 0:433e4ec5de88 | 4 | #include "mbed.h" |
sornpraram | 0:433e4ec5de88 | 5 | |
sornpraram | 0:433e4ec5de88 | 6 | class RMD: public CAN{ |
sornpraram | 0:433e4ec5de88 | 7 | |
sornpraram | 0:433e4ec5de88 | 8 | public: |
sornpraram | 0:433e4ec5de88 | 9 | RMD(PinName rx, PinName tx); |
sornpraram | 0:433e4ec5de88 | 10 | |
sornpraram | 0:433e4ec5de88 | 11 | bool send_speed(int id, int speed); |
sornpraram | 0:433e4ec5de88 | 12 | |
sornpraram | 0:433e4ec5de88 | 13 | bool send_torque(int id, int torque); |
sornpraram | 0:433e4ec5de88 | 14 | |
sornpraram | 10:5221a88e2240 | 15 | bool send_position(int id, int position, int speed); |
sornpraram | 0:433e4ec5de88 | 16 | |
sornpraram | 0:433e4ec5de88 | 17 | void read_pid(); |
sornpraram | 0:433e4ec5de88 | 18 | |
sornpraram | 0:433e4ec5de88 | 19 | void int2byte(int num); |
sornpraram | 0:433e4ec5de88 | 20 | |
sornpraram | 10:5221a88e2240 | 21 | void int2byte2(int pos, int speed); |
sornpraram | 10:5221a88e2240 | 22 | |
sornpraram | 0:433e4ec5de88 | 23 | void status(); |
sornpraram | 0:433e4ec5de88 | 24 | |
sornpraram | 13:09e4446b41cc | 25 | int status_velocity(); |
sornpraram | 5:07e41b6c6692 | 26 | |
sornpraram | 6:c8149dd9503a | 27 | void status_position(); |
sornpraram | 0:433e4ec5de88 | 28 | |
sornpraram | 0:433e4ec5de88 | 29 | char _data[4]; |
sornpraram | 0:433e4ec5de88 | 30 | |
sornpraram | 0:433e4ec5de88 | 31 | char _data_sent[8]; |
sornpraram | 0:433e4ec5de88 | 32 | |
sornpraram | 0:433e4ec5de88 | 33 | char _data_back[8]; |
sornpraram | 0:433e4ec5de88 | 34 | |
sornpraram | 0:433e4ec5de88 | 35 | //void send_speed(int n); |
sornpraram | 0:433e4ec5de88 | 36 | |
sornpraram | 0:433e4ec5de88 | 37 | //unsigned char read_pid(); |
sornpraram | 0:433e4ec5de88 | 38 | |
sornpraram | 0:433e4ec5de88 | 39 | private: |
sornpraram | 12:c6ff996ae2e8 | 40 | unsigned char CANdata[6]; |
sornpraram | 0:433e4ec5de88 | 41 | unsigned char CANsent[8]; |
sornpraram | 0:433e4ec5de88 | 42 | CANMessage msg; |
sornpraram | 0:433e4ec5de88 | 43 | int freq; |
sornpraram | 0:433e4ec5de88 | 44 | char id; |
sornpraram | 0:433e4ec5de88 | 45 | }; |
sornpraram | 0:433e4ec5de88 | 46 | |
sornpraram | 0:433e4ec5de88 | 47 | #endif |