New work version with additional functions

Dependencies:   4DGL-UC ConfigFile MODSERIAL mbed mbos

Fork of CDU_Mbed_35 by Engravity-CDU

main.cpp

Committer:
LvdK
Date:
2012-12-08
Revision:
5:99594f4ab659
Parent:
3:58382fa6e555
Child:
6:e0bf3b244d7c

File content as of revision 5:99594f4ab659:

// L. van der Kolk, ELVEDEKA, Holland //
// File:  main.cpp   version  1.0

#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(p8, p9, p10, p11, p12, p13); // rs, e, d4-d7
 
DigitalOut led1(LED1); // Led1, only for testing

extern Serial USB;      // >>>>>>>>>>> alleen t.b.v TEST output !!

void init_USB();
void init_alivetimer();
void check_alive();

void init_buttons_Mbed();
void scan_buttons_Mbed(); 

void collect_decode_FSdata();
void collect_and_send_FSdata();
//void Braat_test_update_flag_van_LvdK_en_doet_wat_met_de_nieuwe_data();
 
main()
{
// -- This is main.cpp created by LvdK to test all FS communication --

    init_USB();  // : setup USB communication and Rx interrupt
    init_alivetimer();    // : setup alive message timer
    init_buttons_Mbed();   // : <<<<<<<<<<<<<<<<<<<<< test only
    
    lcd.cls(); // : clear LCD display
    lcd.printf(" -- Mbed CDU --\n");
    USB.printf(" --- Mbed CDU ---\n");
    
        
    while (1==1) { // this is my endless main loop
    
        led1 = !led1; // : toggle LED1 to show running program
        //wait(0.02);    
        
        // Check on new received characters from FS in filled Rx ringbuffer
        // and decode to data if relevant:
        collect_decode_FSdata();
        
        // Proces new received FS data:
        // Braat_test_update_flag_van_LvdK_en_doet_wat_met_de_nieuwe_data();
                
        // Send relevant data to FS:
        // LvdK test updates van data Braat en leest de data uit afgesproken datagebied
        // en stuurt dit naar de FS:
        scan_buttons_Mbed();
        
        collect_and_send_FSdata();
        
        check_alive(); // : if 5 sec passed, send alive message
        
    }
}