![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
raspberry pi to stm32f303k8 for serial communication
Drive/Drive.hpp@0:7bc24e8d1591, 2021-05-02 (annotated)
- Committer:
- mukuyo
- Date:
- Sun May 02 15:01:33 2021 +0000
- Revision:
- 0:7bc24e8d1591
update;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mukuyo | 0:7bc24e8d1591 | 1 | #ifndef Drive_hpp |
mukuyo | 0:7bc24e8d1591 | 2 | #define Drive_hpp |
mukuyo | 0:7bc24e8d1591 | 3 | |
mukuyo | 0:7bc24e8d1591 | 4 | #include "mbed.h" |
mukuyo | 0:7bc24e8d1591 | 5 | #include "serial.h" |
mukuyo | 0:7bc24e8d1591 | 6 | #include "Servo.h" |
mukuyo | 0:7bc24e8d1591 | 7 | |
mukuyo | 0:7bc24e8d1591 | 8 | class Drive : public Rasp{ |
mukuyo | 0:7bc24e8d1591 | 9 | public: |
mukuyo | 0:7bc24e8d1591 | 10 | Drive(PinName CAN_TX, PinName CAN_RX); |
mukuyo | 0:7bc24e8d1591 | 11 | void setVelocity(); |
mukuyo | 0:7bc24e8d1591 | 12 | void calcWheelVelocity(); |
mukuyo | 0:7bc24e8d1591 | 13 | void dribble_set(); |
mukuyo | 0:7bc24e8d1591 | 14 | void setMotVel(); |
mukuyo | 0:7bc24e8d1591 | 15 | void initCAN(); |
mukuyo | 0:7bc24e8d1591 | 16 | void can_send(); |
mukuyo | 0:7bc24e8d1591 | 17 | int masuo_send(); |
mukuyo | 0:7bc24e8d1591 | 18 | |
mukuyo | 0:7bc24e8d1591 | 19 | private: |
mukuyo | 0:7bc24e8d1591 | 20 | typedef struct { |
mukuyo | 0:7bc24e8d1591 | 21 | union{ |
mukuyo | 0:7bc24e8d1591 | 22 | signed short Vel_short; |
mukuyo | 0:7bc24e8d1591 | 23 | struct{ |
mukuyo | 0:7bc24e8d1591 | 24 | signed short L:8; |
mukuyo | 0:7bc24e8d1591 | 25 | signed short H:8; |
mukuyo | 0:7bc24e8d1591 | 26 | }Vel_char; |
mukuyo | 0:7bc24e8d1591 | 27 | }Mot0Order; |
mukuyo | 0:7bc24e8d1591 | 28 | |
mukuyo | 0:7bc24e8d1591 | 29 | union{ |
mukuyo | 0:7bc24e8d1591 | 30 | signed short Vel_short; |
mukuyo | 0:7bc24e8d1591 | 31 | struct{ |
mukuyo | 0:7bc24e8d1591 | 32 | signed short L:8; |
mukuyo | 0:7bc24e8d1591 | 33 | signed short H:8; |
mukuyo | 0:7bc24e8d1591 | 34 | }Vel_char; |
mukuyo | 0:7bc24e8d1591 | 35 | }Mot1Order; |
mukuyo | 0:7bc24e8d1591 | 36 | |
mukuyo | 0:7bc24e8d1591 | 37 | union{ |
mukuyo | 0:7bc24e8d1591 | 38 | signed short Vel_short; |
mukuyo | 0:7bc24e8d1591 | 39 | struct{ |
mukuyo | 0:7bc24e8d1591 | 40 | signed short L:8; |
mukuyo | 0:7bc24e8d1591 | 41 | signed short H:8; |
mukuyo | 0:7bc24e8d1591 | 42 | }Vel_char; |
mukuyo | 0:7bc24e8d1591 | 43 | }Mot2Order; |
mukuyo | 0:7bc24e8d1591 | 44 | |
mukuyo | 0:7bc24e8d1591 | 45 | union{ |
mukuyo | 0:7bc24e8d1591 | 46 | signed short Vel_short; |
mukuyo | 0:7bc24e8d1591 | 47 | struct{ |
mukuyo | 0:7bc24e8d1591 | 48 | signed short L:8; |
mukuyo | 0:7bc24e8d1591 | 49 | signed short H:8; |
mukuyo | 0:7bc24e8d1591 | 50 | }Vel_char; |
mukuyo | 0:7bc24e8d1591 | 51 | }Mot3Order; |
mukuyo | 0:7bc24e8d1591 | 52 | |
mukuyo | 0:7bc24e8d1591 | 53 | } OrderMotVel; |
mukuyo | 0:7bc24e8d1591 | 54 | |
mukuyo | 0:7bc24e8d1591 | 55 | OrderMotVel order; |
mukuyo | 0:7bc24e8d1591 | 56 | |
mukuyo | 0:7bc24e8d1591 | 57 | Ticker can_Timer; |
mukuyo | 0:7bc24e8d1591 | 58 | char send_motvel_data[8]; |
mukuyo | 0:7bc24e8d1591 | 59 | CAN canMBED; |
mukuyo | 0:7bc24e8d1591 | 60 | float M[4]; |
mukuyo | 0:7bc24e8d1591 | 61 | float dribble_power; |
mukuyo | 0:7bc24e8d1591 | 62 | DigitalOut LED; |
mukuyo | 0:7bc24e8d1591 | 63 | Servo servo; |
mukuyo | 0:7bc24e8d1591 | 64 | int count; |
mukuyo | 0:7bc24e8d1591 | 65 | }; |
mukuyo | 0:7bc24e8d1591 | 66 | |
mukuyo | 0:7bc24e8d1591 | 67 | #endif |