The Code Repository for the REV0 Steering Wheel.
Dependencies: CANBuffer KS0108_fork mbed-rtos mbed CAN Addresses
Fork of REVO_Updated_Steering by
Steering.h@47:5d3c6f85fa29, 2015-05-30 (annotated)
- Committer:
- jayf
- Date:
- Sat May 30 02:26:23 2015 +0000
- Revision:
- 47:5d3c6f85fa29
- Parent:
- 40:92f08fdc32df
Fixed all known steering wheel issues
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kiran_mbed | 0:313541d8f8be | 1 | #ifndef _STEERING_H |
kiran_mbed | 0:313541d8f8be | 2 | #define _STEERING_H |
kiran_mbed | 0:313541d8f8be | 3 | |
kiran_mbed | 0:313541d8f8be | 4 | #include "mbed.h" |
tmccurbin | 36:8544a8900884 | 5 | #include <math.h> |
palimar | 3:fcec60c7f2c6 | 6 | #include "rtos.h" |
kiran_mbed | 0:313541d8f8be | 7 | #include "KS0108.h" |
kiran_mbed | 0:313541d8f8be | 8 | #include "Arial14.h" |
tmccurbin | 38:d04a430d7fe3 | 9 | #include "Screens.h" |
tmccurbin | 38:d04a430d7fe3 | 10 | #include "CANQueue.h" |
palimar | 16:d2953809fb31 | 11 | #include "CANBuffer.h" |
jayf | 47:5d3c6f85fa29 | 12 | #include "PCM_CAN_IDs.h" |
jayf | 47:5d3c6f85fa29 | 13 | #include "AMS_CAN_IDs.h" |
jayf | 47:5d3c6f85fa29 | 14 | #include "SYS_MGMT_CAN_IDs.h" |
jayf | 47:5d3c6f85fa29 | 15 | #include "Charger_CAN_IDs.h" |
jayf | 47:5d3c6f85fa29 | 16 | #include "Steering_Wheel_CAN_IDs.h" |
kiran_mbed | 0:313541d8f8be | 17 | |
tmccurbin | 36:8544a8900884 | 18 | #define GetFloat *(float*)((void*)(&Rxmsg.data[0])) |
tmccurbin | 36:8544a8900884 | 19 | #define GetFloat4 *(float*)((void*)(&Rxmsg.data[4])) |
jayf | 47:5d3c6f85fa29 | 20 | #define GetFloat8 *(float*)((void*)(&Rxmsg.data[8])) |
palimar | 17:e97c889873e2 | 21 | |
tmccurbin | 36:8544a8900884 | 22 | #define BLButtonGreen DigitalOut l3(P1_24,1); DigitalOut l4(P0_24,0); // SW6, SW8 respectively |
tmccurbin | 36:8544a8900884 | 23 | #define BLButtonRed DigitalOut l3(P1_24,0); DigitalOut l4(P0_24,1); |
kiran_mbed | 0:313541d8f8be | 24 | |
tmccurbin | 36:8544a8900884 | 25 | #define BRButtonGreen DigitalOut l1(P1_28,1); DigitalOut l2(P1_26,0); // SW2, SW4 respectively |
tmccurbin | 36:8544a8900884 | 26 | #define BRButtonRed DigitalOut l1(P1_28,0); DigitalOut l2(P1_26,1); |
kiran_mbed | 0:313541d8f8be | 27 | |
tmccurbin | 36:8544a8900884 | 28 | #define TLButtonGreen DigitalOut u3(P1_4,0); DigitalOut u4(P1_0,1); // SW13, SW15 respectively |
tmccurbin | 36:8544a8900884 | 29 | #define TLButtonRed DigitalOut u3(P1_4,1); DigitalOut u4(P1_0,0); |
kiran_mbed | 0:313541d8f8be | 30 | |
tmccurbin | 36:8544a8900884 | 31 | #define TRButtonGreen DigitalOut u1(P1_14,0); DigitalOut u2(P1_9,1); // SW9, SW11 respectively |
tmccurbin | 36:8544a8900884 | 32 | #define TRButtonRed DigitalOut u1(P1_14,1); DigitalOut u2(P1_9,0); |
kiran_mbed | 0:313541d8f8be | 33 | |
tmccurbin | 36:8544a8900884 | 34 | float pi = 3.14159; |
tmccurbin | 39:e6aa6dcf3f75 | 35 | float WheelRadius = 5.0/6.0; // In feet; same as 10 inches |
tmccurbin | 39:e6aa6dcf3f75 | 36 | float WheelCircumference = 2.0*pi*WheelRadius; //In feet |
palimar | 26:e0256fd314eb | 37 | |
kiran_mbed | 0:313541d8f8be | 38 | Serial pc(USBTX,USBRX); |
palimar | 16:d2953809fb31 | 39 | |
tmccurbin | 36:8544a8900884 | 40 | CANBuffer SteeringCANPort(CAN1, MEDIUM, P3_26); // Initialize the CAN port/pin |
kiran_mbed | 0:313541d8f8be | 41 | |
tmccurbin | 40:92f08fdc32df | 42 | AnalogOut LEDBar(p18); |
kiran_mbed | 0:313541d8f8be | 43 | |
tmccurbin | 36:8544a8900884 | 44 | DigitalOut boSW1(P1_29,1);// SW1 |
tmccurbin | 36:8544a8900884 | 45 | DigitalIn biSWBR(P1_27, PullDown);// SW3, BRight |
kiran_mbed | 0:313541d8f8be | 46 | |
tmccurbin | 36:8544a8900884 | 47 | DigitalOut boSW5(P1_25,1);// SW5 |
tmccurbin | 36:8544a8900884 | 48 | DigitalIn biSWBL(P1_22, PullDown);// SW7, BLeft |
palimar | 21:56890c41ecf1 | 49 | |
tmccurbin | 36:8544a8900884 | 50 | DigitalOut boSW10(P1_10,1);// SW10 |
tmccurbin | 36:8544a8900884 | 51 | DigitalIn biSWTR(P1_8, PullDown);// SW12, TRight |
palimar | 35:b42afc973902 | 52 | |
tmccurbin | 36:8544a8900884 | 53 | DigitalOut boSW14(P1_1,1);// SW14 |
tmccurbin | 36:8544a8900884 | 54 | DigitalIn biSWTL(P0_25, PullDown);// SW16, TLeft |
tmccurbin | 36:8544a8900884 | 55 | |
tmccurbin | 36:8544a8900884 | 56 | #endif //_STEERING_H |