new battery bar

Dependencies:   CAN_IDs CanControl Dashboard PinDetect PowerControl mbed-rtos mbed

main.cpp

Committer:
kwasymodo
Date:
2017-05-12
Revision:
4:dfd10f43cc8b
Parent:
3:b164662f9740
Child:
11:005a50dd7db5
Child:
12:f753bc59c2e8

File content as of revision 4:dfd10f43cc8b:

/*******************************************************************************
This software is especially designed for Solarboat Twente for the use in their Solarboat v1.0

Written by:
Niels Leijen, Jesse van Rhijn, Bram Seinhorst

Thanks to:
Jasper Admiraal, Hidde Pik (hihihihi), Lisa Postma, Heleen Jeurink, Ruben Peters,
Martijn Groot Jebbink, Martijn Wilpshaar, Bram Seinhorst, Robert Geels, Arnoud Meutstege,
Jeroen te Braake, Ids de Vos, Jesse van Rhijn, Sam Benou, Niels Leijen and Mark Bruijn

DISCLAIMER:
THIS SOFTWARE IS SUPPLIED "AS IS" WITHOUT ANY WARRANTIES AND SUPPORT. 
SOLARBOATTWENTE ASSUMES NO RESPONSIBILITY OR LIABILITY FOR THE USE OF THE SOFTWARE.
*******************************************************************************/

// uncomment to send debug information
#define DEBUG

//include 3rd party libraries
#include "mbed.h" //needs to be revision 136 else SD filesystem will not work
#include "rtos.h"

// include Solarboat libraries
#include "pinout.h"
#include "PowerControl.h"

// initialize serial connection for debug
#ifdef DEBUG
RawSerial pc(SERIAL_TX, SERIAL_RX);
#endif

// initialize canbus
CAN can(CAN_RD, CAN_TD);

// initialze onboard leds
DigitalOut ledError(LED3);
DigitalOut ledRelay(LED2);
DigitalOut ledSD(LED1);
DigitalOut ledFona(LED5);
DigitalOut led24V(LED4);

//DigitalOut buckCan(BUCK2);
//DigitalOut buckXSens(BUCK3);
//DigitalOut buckScreen(BUCK4);
//DigitalOut buck24V(BUCK5);


// Thread 1 - Power
void power(){
    PowerControl powercontrol(PUSH_GREEN); 
    
#ifdef DEBUG
    pc.printf("Thread 1 - Power started\r\n ");
#endif

    Thread::wait(osWaitForever);
}


// Thread 0 - DO NOT CHANGE THIS!
int main() {  
#ifdef DEBUG
    pc.baud(115200);
    pc.printf("Starting SOS V1.0\n");
#endif
    // change CAN frequency
    can.frequency(250000);
    
    // initialze threads
    Thread thread1;
    //Thread thread2;
    //Thread thread3;
    //Thread thread4;
    //Thread thread5;
    
    // change thread priority
    //thread2.set_priority(osPriorityBelowNormal);
    
    // start threads
    thread1.start(&power);
    //thread2.start(&calcPi);
    //thread3.start(&motorTest);
    //thread4.start(&canReceive);
    //thread5.start(&relaisOn);
    
    //stop this thread while keeping the other threads running
    Thread::wait(osWaitForever);
}