Xiaohai Li / Mbed 2 deprecated AirBoxProto

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "SysConfig.h"
00002 
00003 #define uart_db uart_pc
00004 
00005 void SystemHalt(void)
00006 {   
00007     #if defined uart_db
00008     uart_db.printf("\n\rOops! System halted! O_o\n\r");
00009     #endif
00010     LedOffAll();
00011     while(1)
00012     {
00013         LedToggle(0);
00014         wait_ms(500);
00015     }
00016 }
00017 
00018 int PeLayerInit(void)
00019 {
00020     int ret = 0;
00021     ret += BoardLibInit();
00022     ret += SHT20_Init();  
00023     
00024     SerialMuxEnable();
00025     SerialMuxSel(0);   
00026     ret += MHZ19_Init();
00027     
00028     SerialMuxSel(1);   
00029     ret += ZPH01_Init();
00030     
00031     SerialMuxSel(2); 
00032     //ret += ESP01_Init();
00033     
00034     SerialMuxSel(3);   
00035     ret += ZE08_Init();
00036     return ret;
00037 }
00038 
00039 int AppLayerInit(void)
00040 {
00041     return 0;
00042 }
00043 
00044 int main(void)
00045 {
00046     if(PeLayerInit() != 0)   
00047         SystemHalt();
00048     
00049     if(AppLayerInit() != 0) 
00050         SystemHalt(); 
00051             
00052     DebugCommander();  
00053     
00054     //Program should never go to here
00055     SystemHalt(); 
00056 }