![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
chad
Dependencies: MCP23017 WattBob_TextLCD mbed-rtos mbed
main.cpp@19:1fecb6fa14a2, 2017-04-04 (annotated)
- Committer:
- f_legge
- Date:
- Tue Apr 04 13:47:53 2017 +0000
- Revision:
- 19:1fecb6fa14a2
- Parent:
- 18:bda795e28ed7
- Child:
- 20:aeb7b7044c31
Experiment with threads;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
f_legge | 19:1fecb6fa14a2 | 1 | // Paramater Allocation |
f_legge | 19:1fecb6fa14a2 | 2 | // |
f_legge | 19:1fecb6fa14a2 | 3 | |
f_legge | 19:1fecb6fa14a2 | 4 | #include "main.h" |
f_legge | 19:1fecb6fa14a2 | 5 | |
f_legge | 19:1fecb6fa14a2 | 6 | // Pointers to LCD Screen |
f_legge | 19:1fecb6fa14a2 | 7 | MCP23017 *par_port; // pointer to 16-bit parallel I/O chip |
f_legge | 19:1fecb6fa14a2 | 8 | WattBob_TextLCD *lcd; // pointer to 2*16 character LCD object |
f_legge | 19:1fecb6fa14a2 | 9 | |
f_legge | 19:1fecb6fa14a2 | 10 | // Serial Connection |
f_legge | 19:1fecb6fa14a2 | 11 | |
f_legge | 19:1fecb6fa14a2 | 12 | Serial pc(USBTX, USBRX,115200); |
f_legge | 19:1fecb6fa14a2 | 13 | |
f_legge | 19:1fecb6fa14a2 | 14 | // Analogue Input |
f_legge | 19:1fecb6fa14a2 | 15 | AnalogIn Accel(p15); // Accelerator Pedal Input |
f_legge | 19:1fecb6fa14a2 | 16 | AnalogIn Brake(p16); // Brake Pedal Input |
f_legge | 19:1fecb6fa14a2 | 17 | |
f_legge | 19:1fecb6fa14a2 | 18 | // Digital Input |
f_legge | 19:1fecb6fa14a2 | 19 | DigitalIn Ignit(p11); // Engine On/Off |
f_legge | 19:1fecb6fa14a2 | 20 | DigitalIn SideL(p12); // Side Light On/Off |
f_legge | 19:1fecb6fa14a2 | 21 | DigitalIn Indi_L(p13); // Left indicator switch |
f_legge | 19:1fecb6fa14a2 | 22 | DigitalIn Indi_R(p14); // Right idicator switch |
f_legge | 19:1fecb6fa14a2 | 23 | |
f_legge | 19:1fecb6fa14a2 | 24 | // Analogue Output |
f_legge | 19:1fecb6fa14a2 | 25 | Servo SpeedIndicator(p21); // Speed Indicator Servo |
f_legge | 19:1fecb6fa14a2 | 26 | |
f_legge | 19:1fecb6fa14a2 | 27 | // Digital Output |
f_legge | 19:1fecb6fa14a2 | 28 | DigitalOut Ignit_LED(LED1); // Ignition LED Indicator |
f_legge | 19:1fecb6fa14a2 | 29 | DigitalOut SideL_LED(LED2); // Side Light Indicator |
f_legge | 19:1fecb6fa14a2 | 30 | DigitalOut Indi_L_LED(LED3); // Left Indicator LED |
f_legge | 19:1fecb6fa14a2 | 31 | DigitalOut Indi_R_LED(LED4); // Right Indicator LED |
f_legge | 19:1fecb6fa14a2 | 32 | |
f_legge | 19:1fecb6fa14a2 | 33 | DigitalOut O_S_LED(p18); // Overspeed LED (REDBOX) |
f_legge | 19:1fecb6fa14a2 | 34 | |
f_legge | 19:1fecb6fa14a2 | 35 | /*typedef struct { |
f_legge | 19:1fecb6fa14a2 | 36 | float speed; |
f_legge | 19:1fecb6fa14a2 | 37 | float accelerator; |
f_legge | 19:1fecb6fa14a2 | 38 | float brake; |
f_legge | 19:1fecb6fa14a2 | 39 | } mail_t; |
f_legge | 19:1fecb6fa14a2 | 40 | |
f_legge | 19:1fecb6fa14a2 | 41 | Mail<mail_t, 100> mail_box;*/ |
f_legge | 19:1fecb6fa14a2 | 42 | |
f_legge | 19:1fecb6fa14a2 | 43 | |
f_legge | 19:1fecb6fa14a2 | 44 | float Accel_Reg; |
f_legge | 19:1fecb6fa14a2 | 45 | float Brake_Reg; |
f_legge | 19:1fecb6fa14a2 | 46 | |
f_legge | 19:1fecb6fa14a2 | 47 | float p; |
f_legge | 19:1fecb6fa14a2 | 48 | |
f_legge | 19:1fecb6fa14a2 | 49 | float Avg_Speed; |
f_legge | 19:1fecb6fa14a2 | 50 | float Speed_In; |
f_legge | 19:1fecb6fa14a2 | 51 | float Speed_0; |
f_legge | 19:1fecb6fa14a2 | 52 | float Speed_1; |
f_legge | 19:1fecb6fa14a2 | 53 | float Speed_2; |
f_legge | 19:1fecb6fa14a2 | 54 | |
f_legge | 19:1fecb6fa14a2 | 55 | float dist; |