All tasks complete

Dependencies:   mbed MCP23017 mbed-rtos WattBob_TextLCD

main.cpp

Committer:
aingks
Date:
2019-04-03
Revision:
14:25241ed5b056
Parent:
12:f4052a23ddc7
Child:
16:b66cb760fb3b

File content as of revision 14:25241ed5b056:

#include "header.h"
/*
    Embedded Software: Assignment 3
    
    Description:
    
    


    Version 0.2 Aingkaran Suppiah
*/

SDATA speed = SDATA();
CARINFO info = CARINFO();
SIMU_DATA sim = SIMU_DATA();



MCP23017            *par_port; // pointer to 16-bit parallel I/O object **was = NULL
WattBob_TextLCD     *display; // pointer to 2*16 chacater LCD object **was = NULL


//Thread delcaration 
Thread thread_1;
Thread thread_2;
Thread thread_3;
Thread thread_4;
Thread thread_5;
Thread thread_6;
Thread thread_7;
Thread thread_8;
Thread thread_9;
Thread thread_10;

//mail queue
Thread MailQueue;

//Mutex
Mutex simuXS;
Mutex speedXS;
Mutex carstateXS;

//mailbox
Mail<SIMU_DATA, 16> mail_box;

int main() {  

    // set up for the LCD
   
    par_port = new MCP23017(p9, p10, 0x40); // initialise 16-bit I/O chip
    
    display = new WattBob_TextLCD(par_port); // initialise 2*26 char display
    
    par_port->write_bit(1,BL_BIT); // turn LCD backlight ON
    
    //task initialization 
    
    thread_1.start(task1readbrake);
    thread_2.start(task2readaccel);
    thread_3.start(task3enginestate);
    thread_4.start(task4average);
    thread_5.start(task5brakeLED);
    thread_6.start(task6speedmonitor);
    thread_7.start(task7displayvalues); 
    thread_8.start(task8sidelights);
    thread_9.start(task9indLED);
    thread_10.start(taskXserialdump);
    
    //mail queue
    MailQueue.start(callback(send_thread));


   


  
    while(true){
            
        }
}