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:
palimar
Date:
Sat Oct 25 15:59:51 2014 +0000
Revision:
17:e97c889873e2
Parent:
16:d2953809fb31
Child:
18:674450a9d98d
swapped digital out for digital in

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"
palimar 3:fcec60c7f2c6 5 #include "rtos.h"
kiran_mbed 0:313541d8f8be 6 #include "KS0108.h"
kiran_mbed 0:313541d8f8be 7
kiran_mbed 0:313541d8f8be 8 #include "Arial12.h"
kiran_mbed 0:313541d8f8be 9 #include "Arial14.h"
kiran_mbed 0:313541d8f8be 10 #include "Comic24.h"
kiran_mbed 0:313541d8f8be 11 #include "vivaldi16.h"
palimar 16:d2953809fb31 12 #include "CANBuffer.h"
kiran_mbed 0:313541d8f8be 13
palimar 17:e97c889873e2 14 #include "LPCDigitalIn.h"
palimar 17:e97c889873e2 15
kiran_mbed 0:313541d8f8be 16 #define SWITCH_ID 410
kiran_mbed 0:313541d8f8be 17
kiran_mbed 0:313541d8f8be 18 #define BATTERY_VOLTAGE_ID 0x304
kiran_mbed 0:313541d8f8be 19 #define BATTERY_POWER_ID 0x306
kiran_mbed 0:313541d8f8be 20 #define BATTERY_CURRENT_ID 0x305
kiran_mbed 0:313541d8f8be 21
kiran_mbed 0:313541d8f8be 22 #define PCM_STATE_ID 20
kiran_mbed 0:313541d8f8be 23
kiran_mbed 0:313541d8f8be 24 #define BATTERY_MIN_CELLVOLTAGE_ID 0x301
kiran_mbed 0:313541d8f8be 25 #define BATTERY_MAX_CELLVOLTAGE_ID 0x300
kiran_mbed 0:313541d8f8be 26 #define BATTERY_AVG_CELLVOLTAGE_ID 0x302
kiran_mbed 0:313541d8f8be 27
kiran_mbed 0:313541d8f8be 28 #define BATTERY_MIN_CELLTEMPERATURE_ID 0x30A
kiran_mbed 0:313541d8f8be 29 #define BATTERY_MAX_CELLTEMPERATURE_ID 0x309
kiran_mbed 0:313541d8f8be 30 #define BATTERY_AVG_CELLTEMPERATURE_ID 0x30B
kiran_mbed 0:313541d8f8be 31 #define AMS_BATTERY_STATE 0x30E // AIRS 7 and 6 // Precharge 3
kiran_mbed 0:313541d8f8be 32
kiran_mbed 0:313541d8f8be 33 Serial pc(USBTX,USBRX);
palimar 16:d2953809fb31 34 CANBuffer CAN_Steering_Buffer(CAN1,MEDIUM);
palimar 16:d2953809fb31 35 LPCDigitalOut CAN_Silent(p3_26, 0);
palimar 16:d2953809fb31 36
palimar 16:d2953809fb31 37 extern "C" void mbed_reset();
kiran_mbed 0:313541d8f8be 38
kiran_mbed 0:313541d8f8be 39 KS0108 display(p26, p21, p22, p23, p25, p24, p8, p7, p6, p5, p13, p14, p12, p11);
kiran_mbed 0:313541d8f8be 40 Ticker call_ledstream;
kiran_mbed 0:313541d8f8be 41
palimar 16:d2953809fb31 42 LPCDigitalOut l1(p1_28,1);// SW2
palimar 16:d2953809fb31 43 LPCDigitalOut l2(p1_26,1);// SW4
kiran_mbed 0:313541d8f8be 44
palimar 16:d2953809fb31 45 LPCDigitalOut l3(p1_24,1);// SW6
palimar 16:d2953809fb31 46 LPCDigitalOut l4(p0_24,1);// SW8
kiran_mbed 0:313541d8f8be 47
palimar 16:d2953809fb31 48 LPCDigitalOut u1(p1_14,0);// SW9
palimar 16:d2953809fb31 49 LPCDigitalOut u2(p1_9,0);// SW11
kiran_mbed 0:313541d8f8be 50
palimar 16:d2953809fb31 51 LPCDigitalOut u3(p1_4,0);// SW13
palimar 16:d2953809fb31 52 LPCDigitalOut u4(p1_0,0);// SW15
kiran_mbed 0:313541d8f8be 53
kiran_mbed 0:313541d8f8be 54 AnalogOut ledstream(p18);
kiran_mbed 0:313541d8f8be 55
kiran_mbed 0:313541d8f8be 56 //SW1 - SW3
palimar 16:d2953809fb31 57 LPCDigitalOut boSW1(p1_29,1);
palimar 17:e97c889873e2 58 LPCDigitalIn biSWBR(p1_27); //BRight
kiran_mbed 0:313541d8f8be 59
palimar 16:d2953809fb31 60 LPCDigitalOut boSW5(p1_25,1);
palimar 17:e97c889873e2 61 LPCDigitalIn biSWBL(p1_22); //BLeft
kiran_mbed 0:313541d8f8be 62
palimar 16:d2953809fb31 63 LPCDigitalOut boSW10(p1_10,1);
palimar 17:e97c889873e2 64 LPCDigitalIn biSWTR(p1_8); //TRight
kiran_mbed 0:313541d8f8be 65
palimar 16:d2953809fb31 66 LPCDigitalOut boSW14(p1_1,1);
palimar 17:e97c889873e2 67 LPCDigitalIn biSWTL(p0_25); //TLeft
kiran_mbed 0:313541d8f8be 68
kiran_mbed 0:313541d8f8be 69 typedef union convert{
kiran_mbed 0:313541d8f8be 70 float FLOAT;
kiran_mbed 0:313541d8f8be 71 char C_FLOAT[4];
kiran_mbed 0:313541d8f8be 72 }ftc;
kiran_mbed 0:313541d8f8be 73
kiran_mbed 0:313541d8f8be 74 char SwitchName[15][13]={
kiran_mbed 0:313541d8f8be 75 "fuse",
kiran_mbed 0:313541d8f8be 76 "ams",
kiran_mbed 0:313541d8f8be 77 "imd",
kiran_mbed 0:313541d8f8be 78 "pcm",
kiran_mbed 0:313541d8f8be 79 "brkp",
kiran_mbed 0:313541d8f8be 80 "lft",
kiran_mbed 0:313541d8f8be 81 "intl",
kiran_mbed 0:313541d8f8be 82 "brko",
kiran_mbed 0:313541d8f8be 83 "ckpt",
kiran_mbed 0:313541d8f8be 84 "rgt",
kiran_mbed 0:313541d8f8be 85 "hvd",
kiran_mbed 0:313541d8f8be 86 "tsms"
kiran_mbed 0:313541d8f8be 87 };
kiran_mbed 0:313541d8f8be 88
kiran_mbed 0:313541d8f8be 89 int SwitchPosition[13][2]={
kiran_mbed 0:313541d8f8be 90 {0,16}, //fuse
kiran_mbed 0:313541d8f8be 91 {25,16}, //ams
kiran_mbed 0:313541d8f8be 92 {50,16}, //imd
kiran_mbed 0:313541d8f8be 93 {70,16}, //pcm
kiran_mbed 0:313541d8f8be 94 {93,16}, //brkp
kiran_mbed 0:313541d8f8be 95 {117,16}, //lft
kiran_mbed 0:313541d8f8be 96 {0,32}, //intl
kiran_mbed 0:313541d8f8be 97 {17,32}, //brko
kiran_mbed 0:313541d8f8be 98 {42,32}, //ckpt
kiran_mbed 0:313541d8f8be 99 {65,32}, //rgt
kiran_mbed 0:313541d8f8be 100 {81,32}, //hvd
kiran_mbed 0:313541d8f8be 101 {102,32}, //tsm
kiran_mbed 0:313541d8f8be 102 };
kiran_mbed 0:313541d8f8be 103
kiran_mbed 0:313541d8f8be 104 int maxScreen=5;
kiran_mbed 0:313541d8f8be 105 int screen;
palimar 9:e946cafa3cae 106
palimar 9:e946cafa3cae 107 char drive_status;
palimar 13:1f05dcd9ae0e 108 char drive_status_request;
palimar 9:e946cafa3cae 109 char reset_body;
palimar 9:e946cafa3cae 110
palimar 13:1f05dcd9ae0e 111 CANMessage Txmsg_drive_status_request(0x501,&drive_status_request,1);
palimar 9:e946cafa3cae 112 CANMessage Txmsg_reset(0x502,&reset_body,1);
palimar 9:e946cafa3cae 113
kiran_mbed 0:313541d8f8be 114 #endif /* STEERING_H */