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

Steering.h

Committer:
palimar
Date:
2014-10-25
Revision:
17:e97c889873e2
Parent:
16:d2953809fb31
Child:
18:674450a9d98d

File content as of revision 17:e97c889873e2:

#ifndef _STEERING_H
#define _STEERING_H

#include "mbed.h"
#include "rtos.h"
#include "KS0108.h"

#include "Arial12.h"
#include "Arial14.h"
#include "Comic24.h"
#include "vivaldi16.h"
#include "CANBuffer.h"

#include "LPCDigitalIn.h"

#define SWITCH_ID 410

#define BATTERY_VOLTAGE_ID 0x304
#define BATTERY_POWER_ID 0x306
#define BATTERY_CURRENT_ID 0x305

#define PCM_STATE_ID 20

#define BATTERY_MIN_CELLVOLTAGE_ID 0x301
#define BATTERY_MAX_CELLVOLTAGE_ID 0x300
#define BATTERY_AVG_CELLVOLTAGE_ID 0x302

#define BATTERY_MIN_CELLTEMPERATURE_ID 0x30A
#define BATTERY_MAX_CELLTEMPERATURE_ID 0x309
#define BATTERY_AVG_CELLTEMPERATURE_ID 0x30B
#define AMS_BATTERY_STATE 0x30E          // AIRS 7 and 6 // Precharge 3

Serial pc(USBTX,USBRX);
CANBuffer CAN_Steering_Buffer(CAN1,MEDIUM);
LPCDigitalOut CAN_Silent(p3_26, 0);

extern "C" void mbed_reset();

KS0108 display(p26, p21, p22, p23, p25, p24, p8, p7, p6, p5, p13, p14, p12, p11); 
Ticker call_ledstream;

LPCDigitalOut l1(p1_28,1);//    SW2
LPCDigitalOut l2(p1_26,1);//    SW4
    
LPCDigitalOut l3(p1_24,1);//    SW6
LPCDigitalOut l4(p0_24,1);//    SW8

LPCDigitalOut u1(p1_14,0);//    SW9 
LPCDigitalOut u2(p1_9,0);//     SW11

LPCDigitalOut u3(p1_4,0);//     SW13
LPCDigitalOut u4(p1_0,0);//     SW15

AnalogOut ledstream(p18);

//SW1 - SW3
LPCDigitalOut boSW1(p1_29,1);
LPCDigitalIn biSWBR(p1_27);     //BRight

LPCDigitalOut boSW5(p1_25,1);
LPCDigitalIn biSWBL(p1_22);     //BLeft

LPCDigitalOut boSW10(p1_10,1);
LPCDigitalIn biSWTR(p1_8);     //TRight

LPCDigitalOut boSW14(p1_1,1);
LPCDigitalIn biSWTL(p0_25);    //TLeft

typedef union convert{
        float FLOAT;
        char C_FLOAT[4];
        }ftc;

char SwitchName[15][13]={
    "fuse",
    "ams",
    "imd",
    "pcm",
    "brkp",
    "lft",
    "intl",
    "brko",
    "ckpt",
    "rgt",
    "hvd",
    "tsms"
};

int SwitchPosition[13][2]={
    {0,16},     //fuse
    {25,16},    //ams
    {50,16},    //imd
    {70,16},    //pcm
    {93,16},    //brkp
    {117,16},   //lft
    {0,32},     //intl
    {17,32},    //brko
    {42,32},    //ckpt
    {65,32},    //rgt
    {81,32},    //hvd
    {102,32},   //tsm
    };
    
int maxScreen=5;
int screen; 

char drive_status;
char drive_status_request;
char reset_body;

CANMessage Txmsg_drive_status_request(0x501,&drive_status_request,1);
CANMessage Txmsg_reset(0x502,&reset_body,1);

#endif /* STEERING_H */