![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All tasks complete
Dependencies: mbed MCP23017 mbed-rtos WattBob_TextLCD
header.h@18:65c51c80a165, 2019-04-03 (annotated)
- Committer:
- aingks
- Date:
- Wed Apr 03 20:06:28 2019 +0000
- Revision:
- 18:65c51c80a165
- Parent:
- 12:f4052a23ddc7
- Child:
- 14:25241ed5b056
clean code; removed alternative code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aingks | 0:0943f040009c | 1 | #ifndef HEADER_whatever |
aingks | 0:0943f040009c | 2 | #define HEADER_whatever |
aingks | 0:0943f040009c | 3 | |
aingks | 0:0943f040009c | 4 | #include "mbed.h" |
aingks | 12:f4052a23ddc7 | 5 | #include "rtos.h" |
aingks | 3:f88d667629e6 | 6 | #include "WattBob_TextLCD.h" |
aingks | 8:3f3f2c2e2046 | 7 | |
aingks | 4:27340b291c09 | 8 | #include "MCP23017.h" |
aingks | 0:0943f040009c | 9 | |
aingks | 0:0943f040009c | 10 | #define pin_analog_1 p15 |
aingks | 0:0943f040009c | 11 | #define pin_analog_2 p16 |
aingks | 0:0943f040009c | 12 | |
aingks | 0:0943f040009c | 13 | #define pin_digital_1 p17 |
aingks | 0:0943f040009c | 14 | #define pin_digital_2 p18 |
aingks | 0:0943f040009c | 15 | #define pin_digital_3 p19 |
aingks | 0:0943f040009c | 16 | #define pin_digital_4 p20 |
aingks | 0:0943f040009c | 17 | |
aingks | 0:0943f040009c | 18 | #define pin_LED1 LED1 |
aingks | 0:0943f040009c | 19 | #define pin_LED2 LED2 |
aingks | 0:0943f040009c | 20 | #define pin_LED3 LED3 |
aingks | 0:0943f040009c | 21 | #define pin_LED4 LED4 |
aingks | 0:0943f040009c | 22 | #define pin_LED5 p25 |
aingks | 0:0943f040009c | 23 | #define pin_LED6 p26 |
aingks | 0:0943f040009c | 24 | |
aingks | 0:0943f040009c | 25 | |
aingks | 12:f4052a23ddc7 | 26 | #define MAXSPEED 100 |
aingks | 5:f5dda79b93cb | 27 | #define SAMPLESIZE 5 |
aingks | 7:87f7ba90fdce | 28 | #define SPEEDLIMIT 88 |
aingks | 9:2fd97246b8f0 | 29 | |
aingks | 5:f5dda79b93cb | 30 | //FREQUENCIES |
aingks | 5:f5dda79b93cb | 31 | #define CLOCKFREQ 20 |
aingks | 6:abbd51d9b045 | 32 | #define TASKFREQ1 8 |
aingks | 6:abbd51d9b045 | 33 | #define TASKFREQ2 10 |
aingks | 6:abbd51d9b045 | 34 | #define TASKFREQ3 4 |
aingks | 6:abbd51d9b045 | 35 | #define TASKFREQ4 4 |
aingks | 6:abbd51d9b045 | 36 | #define TASKFREQ5 4 |
aingks | 6:abbd51d9b045 | 37 | #define TASKFREQ6 5 |
aingks | 6:abbd51d9b045 | 38 | #define TASKFREQ7 2 |
aingks | 6:abbd51d9b045 | 39 | #define TASKFREQ8 4 |
aingks | 6:abbd51d9b045 | 40 | #define TASKFREQ9 1 |
aingks | 6:abbd51d9b045 | 41 | #define TASKFREQ9S2 2 |
aingks | 6:abbd51d9b045 | 42 | #define TASKFREQX 0.5 |
aingks | 5:f5dda79b93cb | 43 | |
aingks | 5:f5dda79b93cb | 44 | |
aingks | 0:0943f040009c | 45 | |
aingks | 0:0943f040009c | 46 | |
aingks | 0:0943f040009c | 47 | //call the functions at the end for the main |
aingks | 0:0943f040009c | 48 | |
aingks | 0:0943f040009c | 49 | |
aingks | 0:0943f040009c | 50 | //STRUCTURE |
aingks | 0:0943f040009c | 51 | typedef struct |
aingks | 0:0943f040009c | 52 | { |
aingks | 0:0943f040009c | 53 | float brakevalue; |
aingks | 1:c4f62ef9b5b7 | 54 | float accelvalue; |
aingks | 0:0943f040009c | 55 | float array[5]; |
aingks | 0:0943f040009c | 56 | float average; |
aingks | 0:0943f040009c | 57 | float rawspeed; |
aingks | 0:0943f040009c | 58 | }SDATA; |
aingks | 0:0943f040009c | 59 | |
aingks | 0:0943f040009c | 60 | |
aingks | 0:0943f040009c | 61 | |
aingks | 4:27340b291c09 | 62 | |
aingks | 0:0943f040009c | 63 | |
aingks | 2:9d6d07c9cc9c | 64 | |
aingks | 0:0943f040009c | 65 | typedef struct |
aingks | 0:0943f040009c | 66 | { |
aingks | 8:3f3f2c2e2046 | 67 | int ENGINESTATE; |
aingks | 8:3f3f2c2e2046 | 68 | float odometer; |
aingks | 12:f4052a23ddc7 | 69 | float leftind; |
aingks | 12:f4052a23ddc7 | 70 | float rightind; |
aingks | 12:f4052a23ddc7 | 71 | float sideind; |
aingks | 4:27340b291c09 | 72 | }CARINFO; |
aingks | 1:c4f62ef9b5b7 | 73 | |
aingks | 4:27340b291c09 | 74 | |
aingks | 0:0943f040009c | 75 | |
aingks | 4:27340b291c09 | 76 | typedef struct |
aingks | 4:27340b291c09 | 77 | { |
aingks | 4:27340b291c09 | 78 | float brakevalue; |
aingks | 4:27340b291c09 | 79 | float accelvalue; |
aingks | 4:27340b291c09 | 80 | float odometer; |
aingks | 4:27340b291c09 | 81 | float rawspeed; |
aingks | 4:27340b291c09 | 82 | |
aingks | 4:27340b291c09 | 83 | }SIMU_DATA; |
aingks | 3:f88d667629e6 | 84 | |
aingks | 4:27340b291c09 | 85 | |
aingks | 0:0943f040009c | 86 | |
aingks | 0:0943f040009c | 87 | |
aingks | 0:0943f040009c | 88 | //calling all functions |
aingks | 0:0943f040009c | 89 | |
aingks | 0:0943f040009c | 90 | void task1readbrake(); |
aingks | 0:0943f040009c | 91 | void task2readaccel(); |
aingks | 0:0943f040009c | 92 | void task3enginestate(); |
aingks | 0:0943f040009c | 93 | void task4average(); |
aingks | 0:0943f040009c | 94 | void task5brakeLED(); |
aingks | 0:0943f040009c | 95 | void task6speedmonitor(); |
aingks | 0:0943f040009c | 96 | void task7displayvalues(); |
aingks | 0:0943f040009c | 97 | void task8sidelights(); |
aingks | 12:f4052a23ddc7 | 98 | void task9indLED(); |
aingks | 12:f4052a23ddc7 | 99 | void taskXserialdump(); |
aingks | 0:0943f040009c | 100 | |
aingks | 0:0943f040009c | 101 | |
aingks | 0:0943f040009c | 102 | #endif |