![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All tasks complete
Dependencies: mbed MCP23017 mbed-rtos WattBob_TextLCD
main.cpp@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 | #include "header.h" |
aingks | 1:c4f62ef9b5b7 | 2 | /* |
aingks | 1:c4f62ef9b5b7 | 3 | Embedded Software: Assignment 3 |
aingks | 1:c4f62ef9b5b7 | 4 | |
aingks | 1:c4f62ef9b5b7 | 5 | Description: |
aingks | 1:c4f62ef9b5b7 | 6 | |
aingks | 1:c4f62ef9b5b7 | 7 | |
aingks | 0:0943f040009c | 8 | |
aingks | 0:0943f040009c | 9 | |
aingks | 3:f88d667629e6 | 10 | Version 0.2 Aingkaran Suppiah |
aingks | 1:c4f62ef9b5b7 | 11 | */ |
aingks | 1:c4f62ef9b5b7 | 12 | |
aingks | 4:27340b291c09 | 13 | SDATA speed = SDATA(); |
aingks | 4:27340b291c09 | 14 | CARINFO info = CARINFO(); |
aingks | 4:27340b291c09 | 15 | SIMU_DATA sim = SIMU_DATA(); |
aingks | 4:27340b291c09 | 16 | |
aingks | 4:27340b291c09 | 17 | |
aingks | 4:27340b291c09 | 18 | |
aingks | 8:3f3f2c2e2046 | 19 | MCP23017 *par_port; // pointer to 16-bit parallel I/O object **was = NULL |
aingks | 8:3f3f2c2e2046 | 20 | WattBob_TextLCD *display; // pointer to 2*16 chacater LCD object **was = NULL |
aingks | 4:27340b291c09 | 21 | |
aingks | 12:f4052a23ddc7 | 22 | Thread thread_1; |
aingks | 12:f4052a23ddc7 | 23 | Thread thread_2; |
aingks | 12:f4052a23ddc7 | 24 | Thread thread_3; |
aingks | 12:f4052a23ddc7 | 25 | Thread thread_4; |
aingks | 12:f4052a23ddc7 | 26 | Thread thread_5; |
aingks | 12:f4052a23ddc7 | 27 | Thread thread_6; |
aingks | 12:f4052a23ddc7 | 28 | Thread thread_7; |
aingks | 12:f4052a23ddc7 | 29 | Thread thread_8; |
aingks | 12:f4052a23ddc7 | 30 | Thread thread_9; |
aingks | 12:f4052a23ddc7 | 31 | Thread thread_10; |
aingks | 4:27340b291c09 | 32 | |
aingks | 4:27340b291c09 | 33 | |
aingks | 4:27340b291c09 | 34 | Mutex simuXS; |
aingks | 4:27340b291c09 | 35 | Mutex speedXS; |
aingks | 4:27340b291c09 | 36 | Mutex carstateXS; |
aingks | 0:0943f040009c | 37 | |
aingks | 8:3f3f2c2e2046 | 38 | int main() { |
aingks | 8:3f3f2c2e2046 | 39 | |
aingks | 12:f4052a23ddc7 | 40 | // set up for the LCD |
aingks | 12:f4052a23ddc7 | 41 | |
aingks | 8:3f3f2c2e2046 | 42 | par_port = new MCP23017(p9, p10, 0x40); // initialise 16-bit I/O chip |
aingks | 8:3f3f2c2e2046 | 43 | |
aingks | 8:3f3f2c2e2046 | 44 | display = new WattBob_TextLCD(par_port); // initialise 2*26 char display |
aingks | 8:3f3f2c2e2046 | 45 | |
aingks | 8:3f3f2c2e2046 | 46 | par_port->write_bit(1,BL_BIT); // turn LCD backlight ON |
aingks | 8:3f3f2c2e2046 | 47 | |
aingks | 8:3f3f2c2e2046 | 48 | |
aingks | 12:f4052a23ddc7 | 49 | thread_1.start(task1readbrake); |
aingks | 12:f4052a23ddc7 | 50 | thread_2.start(task2readaccel); |
aingks | 12:f4052a23ddc7 | 51 | thread_3.start(task3enginestate); |
aingks | 12:f4052a23ddc7 | 52 | thread_4.start(task4average); |
aingks | 12:f4052a23ddc7 | 53 | thread_5.start(task5brakeLED); |
aingks | 12:f4052a23ddc7 | 54 | thread_6.start(task6speedmonitor); |
aingks | 12:f4052a23ddc7 | 55 | thread_7.start(task7displayvalues); |
aingks | 12:f4052a23ddc7 | 56 | thread_8.start(task8sidelights); |
aingks | 12:f4052a23ddc7 | 57 | thread_9.start(task9indLED); |
aingks | 12:f4052a23ddc7 | 58 | thread_10.start(taskXserialdump); |
aingks | 8:3f3f2c2e2046 | 59 | |
aingks | 8:3f3f2c2e2046 | 60 | |
aingks | 3:f88d667629e6 | 61 | |
aingks | 12:f4052a23ddc7 | 62 | |
aingks | 8:3f3f2c2e2046 | 63 | |
aingks | 0:0943f040009c | 64 | |
aingks | 8:3f3f2c2e2046 | 65 | while(1){ |
aingks | 8:3f3f2c2e2046 | 66 | |
aingks | 8:3f3f2c2e2046 | 67 | } |
aingks | 0:0943f040009c | 68 | } |