Railway Challenge
/
challenge
Uncommenting of part that allow supercaps to charge up from the batteries
definitions.cpp@29:8149eec6d6e7, 2022-06-15 (annotated)
- Committer:
- jamesmcildowietfl
- Date:
- Wed Jun 15 11:26:58 2022 +0000
- Revision:
- 29:8149eec6d6e7
- Parent:
- 27:0098df64b05b
Added Ediz light outputs. ; //Lights; DigitalOut FrontLight(PE_12);; DigitalOut BackLight(PE_14);; DigitalOut BeaconLight(PE_15);
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rwcjoliver | 0:4788e1df7b55 | 1 | #include <mbed.h> |
rwcjoliver | 0:4788e1df7b55 | 2 | #include "definitions.h" |
rwcjoliver | 0:4788e1df7b55 | 3 | |
rwcjoliver | 0:4788e1df7b55 | 4 | // COMMS DEFINITIONS |
rwcjoliver | 0:4788e1df7b55 | 5 | Serial pc(USBTX, USBRX); |
rwcjoliver | 0:4788e1df7b55 | 6 | |
rwcjoliver | 0:4788e1df7b55 | 7 | // INTERRUPTS |
rwcjoliver | 0:4788e1df7b55 | 8 | InterruptIn rtc_output(PF_11, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 9 | InterruptIn autoStopTrigger(PD_2, PullDown); //interrupt on lineside equipment detection |
rwcjoliver | 0:4788e1df7b55 | 10 | InterruptIn hallSensor(PG_3); // For Hall Sensor Tachometer |
rwcjoliver | 0:4788e1df7b55 | 11 | |
rwcjoliver | 0:4788e1df7b55 | 12 | // PIN DEFINITIONS |
rwcjoliver | 0:4788e1df7b55 | 13 | |
rwcjoliver | 0:4788e1df7b55 | 14 | // INNOVATION/ COLLISION DETECTION |
rwcjoliver | 0:4788e1df7b55 | 15 | AnalogIn irSensor_1(PF_6); |
rwcjoliver | 0:4788e1df7b55 | 16 | AnalogIn irSensor_2(PF_7); |
rwcjoliver | 0:4788e1df7b55 | 17 | AnalogIn irSensor_3(PC_2); |
rwcjoliver | 0:4788e1df7b55 | 18 | |
rwcjoliver | 0:4788e1df7b55 | 19 | //RTC individual inputs// |
rwcjoliver | 0:4788e1df7b55 | 20 | DigitalIn rtc_1(PG_4, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 21 | DigitalIn rtc_2(PG_6, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 22 | DigitalIn rtc_3(PG_7, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 23 | DigitalIn rtc_4(PG_5, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 24 | DigitalIn rtc_5(PD_10, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 25 | DigitalIn rtc_6(PG_8, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 26 | DigitalIn rtc_7(PE_0, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 27 | DigitalIn rtc_override(PG_14, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 28 | |
rwcjoliver | 0:4788e1df7b55 | 29 | // RTC Outputs |
rwcjoliver | 0:4788e1df7b55 | 30 | DigitalOut rtc_Trigger(PD_14); |
rwcjoliver | 0:4788e1df7b55 | 31 | |
rwcjoliver | 0:4788e1df7b55 | 32 | // Output LEDs |
rwcjoliver | 0:4788e1df7b55 | 33 | //DigitalOut led_rtcOutput(); // No need as RTC has led output |
rwcjoliver | 0:4788e1df7b55 | 34 | //DigitalOut led_emergencyBrake(PE_11); |
rwcjoliver | 0:4788e1df7b55 | 35 | DigitalOut led_parkMode(PF_10); |
rwcjoliver | 0:4788e1df7b55 | 36 | |
rwcjoliver | 0:4788e1df7b55 | 37 | |
rwcjoliver | 0:4788e1df7b55 | 38 | //Motor outputs // ENSURE YOU USE DAC PINS - BOTH MOTORS SHARE PINS |
rwcjoliver | 0:4788e1df7b55 | 39 | AnalogOut motorAccelerator(PA_5); |
rwcjoliver | 0:4788e1df7b55 | 40 | AnalogOut motorBrake(PA_4); |
rwcjoliver | 0:4788e1df7b55 | 41 | |
rwcjoliver | 0:4788e1df7b55 | 42 | ////motor 1 settings |
rwcjoliver | 0:4788e1df7b55 | 43 | DigitalOut keySwitchM1(PF_1); |
rwcjoliver | 0:4788e1df7b55 | 44 | DigitalOut directionFwd(PF_0); |
rwcjoliver | 0:4788e1df7b55 | 45 | DigitalOut directionRev(PD_1); |
rwcjoliver | 0:4788e1df7b55 | 46 | //DigitalOut directionM1(PA_3); // FORWARD AND REVERSE NEED TO BE SEPARATE |
rwcjoliver | 0:4788e1df7b55 | 47 | DigitalOut footswitchM1(PD_4); |
rwcjoliver | 0:4788e1df7b55 | 48 | DigitalOut seatM1(PD_5); |
rwcjoliver | 0:4788e1df7b55 | 49 | DigitalOut inchFwdM1(PD_6); |
rwcjoliver | 0:4788e1df7b55 | 50 | DigitalOut speedLimit2M1(PD_7); |
rwcjoliver | 0:4788e1df7b55 | 51 | DigitalOut speedLimit3M1(PE_3); |
rwcjoliver | 0:4788e1df7b55 | 52 | |
rwcjoliver | 0:4788e1df7b55 | 53 | ////motor 2 settings; |
rwcjoliver | 0:4788e1df7b55 | 54 | //DigitalOut keySwitchM2(PD_10); |
rwcjoliver | 0:4788e1df7b55 | 55 | //DigitalOut directionM2(PG_6); |
rwcjoliver | 0:4788e1df7b55 | 56 | //DigitalOut footswitchM2(PG_4); |
rwcjoliver | 0:4788e1df7b55 | 57 | //DigitalOut seatM2(PC_8); |
rwcjoliver | 0:4788e1df7b55 | 58 | //DigitalOut inchFwdM2(PC_6); |
rwcjoliver | 0:4788e1df7b55 | 59 | //DigitalOut speedLimit2M2(PA_12); |
rwcjoliver | 0:4788e1df7b55 | 60 | //DigitalOut speedLimit3M2(PA_11); |
rwcjoliver | 0:4788e1df7b55 | 61 | |
rwcjoliver | 0:4788e1df7b55 | 62 | DigitalIn superCapPreCharge(PB_11); // Supercaps are pre-charged |
rwcjoliver | 0:4788e1df7b55 | 63 | DigitalIn superCapVoltage(PB_2); // Supercaps are Full |
rwcjoliver | 0:4788e1df7b55 | 64 | |
rwcjoliver | 0:4788e1df7b55 | 65 | //Contactors as digital outputs |
rwcjoliver | 0:4788e1df7b55 | 66 | DigitalOut contactBatt(PE_8); // C-BAT |
rwcjoliver | 0:4788e1df7b55 | 67 | DigitalOut contactCompressor(PG_10); // C-COM |
rwcjoliver | 0:4788e1df7b55 | 68 | DigitalOut contactCapCharge(PG_11); // C-CHA |
rwcjoliver | 0:4788e1df7b55 | 69 | |
rwcjoliver | 0:4788e1df7b55 | 70 | //DigitalOut contactMtr1(PE_0); // DRIVEN BY MOTOR CONTROLLER |
rwcjoliver | 0:4788e1df7b55 | 71 | //DigitalOut contactMtr2(PG_8); |
rwcjoliver | 0:4788e1df7b55 | 72 | |
rwcjoliver | 0:4788e1df7b55 | 73 | //mechanical braking and other air components. |
cdevarakonda | 27:0098df64b05b | 74 | DigitalOut brakeValve32(PD_3); //wire 90 - back brake pin |
cdevarakonda | 27:0098df64b05b | 75 | DigitalOut brakeValve22(PC_0); //wire 91 - front brake pin |
rwcjoliver | 0:4788e1df7b55 | 76 | DigitalOut whistleValve32(PG_15); |
rwcjoliver | 0:4788e1df7b55 | 77 | |
rwcjoliver | 0:4788e1df7b55 | 78 | DigitalIn pressureSwitch1(PC_13, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 79 | DigitalIn pressureSwitch2(PC_1, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 80 | DigitalIn pressureSwitch3(PC_15, PullUp); |
rwcjoliver | 0:4788e1df7b55 | 81 | //DigitalIn brakePressure(PH_0); // NOT INSTALLED |
jamesmcildowietfl | 29:8149eec6d6e7 | 82 | DigitalIn mainlinePressure(PH_1, PullUp); |
jamesmcildowietfl | 29:8149eec6d6e7 | 83 | |
jamesmcildowietfl | 29:8149eec6d6e7 | 84 | //Lights |
jamesmcildowietfl | 29:8149eec6d6e7 | 85 | DigitalOut FrontLight(PE_12); |
jamesmcildowietfl | 29:8149eec6d6e7 | 86 | DigitalOut BackLight(PE_14); |
jamesmcildowietfl | 29:8149eec6d6e7 | 87 | DigitalOut BeaconLight(PE_15); |