The Code Repository for the REV0 Steering Wheel.

Dependencies:   CANBuffer KS0108_fork mbed-rtos mbed CAN Addresses

Fork of REVO_Updated_Steering by Penn Electric

Committer:
tmccurbin
Date:
Sun Feb 08 05:47:05 2015 +0000
Revision:
39:e6aa6dcf3f75
Parent:
38:d04a430d7fe3
Child:
40:92f08fdc32df
Fixed filters. Implemented thresholds for variable updates.

Who changed what in which revision?

UserRevisionLine numberNew 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"
kiran_mbed 0:313541d8f8be 12
tmccurbin 36:8544a8900884 13 #define GetFloat *(float*)((void*)(&Rxmsg.data[0]))
tmccurbin 36:8544a8900884 14 #define GetFloat4 *(float*)((void*)(&Rxmsg.data[4]))
palimar 17:e97c889873e2 15
tmccurbin 36:8544a8900884 16 #define BLButtonGreen DigitalOut l3(P1_24,1); DigitalOut l4(P0_24,0); // SW6, SW8 respectively
tmccurbin 36:8544a8900884 17 #define BLButtonRed DigitalOut l3(P1_24,0); DigitalOut l4(P0_24,1);
kiran_mbed 0:313541d8f8be 18
tmccurbin 36:8544a8900884 19 #define BRButtonGreen DigitalOut l1(P1_28,1); DigitalOut l2(P1_26,0); // SW2, SW4 respectively
tmccurbin 36:8544a8900884 20 #define BRButtonRed DigitalOut l1(P1_28,0); DigitalOut l2(P1_26,1);
kiran_mbed 0:313541d8f8be 21
tmccurbin 36:8544a8900884 22 #define TLButtonGreen DigitalOut u3(P1_4,0); DigitalOut u4(P1_0,1); // SW13, SW15 respectively
tmccurbin 36:8544a8900884 23 #define TLButtonRed DigitalOut u3(P1_4,1); DigitalOut u4(P1_0,0);
kiran_mbed 0:313541d8f8be 24
tmccurbin 36:8544a8900884 25 #define TRButtonGreen DigitalOut u1(P1_14,0); DigitalOut u2(P1_9,1); // SW9, SW11 respectively
tmccurbin 36:8544a8900884 26 #define TRButtonRed DigitalOut u1(P1_14,1); DigitalOut u2(P1_9,0);
kiran_mbed 0:313541d8f8be 27
tmccurbin 36:8544a8900884 28 float pi = 3.14159;
tmccurbin 39:e6aa6dcf3f75 29 float WheelRadius = 5.0/6.0; // In feet; same as 10 inches
tmccurbin 39:e6aa6dcf3f75 30 float WheelCircumference = 2.0*pi*WheelRadius; //In feet
palimar 26:e0256fd314eb 31
kiran_mbed 0:313541d8f8be 32 Serial pc(USBTX,USBRX);
palimar 16:d2953809fb31 33
tmccurbin 36:8544a8900884 34 CANBuffer SteeringCANPort(CAN1, MEDIUM, P3_26); // Initialize the CAN port/pin
kiran_mbed 0:313541d8f8be 35
tmccurbin 36:8544a8900884 36 AnalogOut ledstream(p18); // This appears to iniialize the pin as an analog out, and probably defaults to low. Without this, the LED bar would have a few lights on.
kiran_mbed 0:313541d8f8be 37
tmccurbin 36:8544a8900884 38 DigitalOut boSW1(P1_29,1);// SW1
tmccurbin 36:8544a8900884 39 DigitalIn biSWBR(P1_27, PullDown);// SW3, BRight
kiran_mbed 0:313541d8f8be 40
tmccurbin 36:8544a8900884 41 DigitalOut boSW5(P1_25,1);// SW5
tmccurbin 36:8544a8900884 42 DigitalIn biSWBL(P1_22, PullDown);// SW7, BLeft
palimar 21:56890c41ecf1 43
tmccurbin 36:8544a8900884 44 DigitalOut boSW10(P1_10,1);// SW10
tmccurbin 36:8544a8900884 45 DigitalIn biSWTR(P1_8, PullDown);// SW12, TRight
palimar 35:b42afc973902 46
tmccurbin 36:8544a8900884 47 DigitalOut boSW14(P1_1,1);// SW14
tmccurbin 36:8544a8900884 48 DigitalIn biSWTL(P0_25, PullDown);// SW16, TLeft
tmccurbin 36:8544a8900884 49
tmccurbin 36:8544a8900884 50 #endif //_STEERING_H