Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
src/main.cpp
- Committer:
- davidjhoward
- Date:
- 2016-09-08
- Revision:
- 31:4b1587034318
- Parent:
- 21:85c69494c0ff
- Child:
- 32:79ec3a4c0ec5
File content as of revision 31:4b1587034318:
/******************************************************************************
*
* File: main.cpp
* Desciption: main ICE driver routine
*
*****************************************************************************/
#include "mbed.h"
#include "rtos.h"
#include <stdio.h>
#include "mDot.h"
#include "global.h"
#include "ConfigurationHandler.h"
#include "AnalyticsLogger.h"
#include "ModbusMaster.h"
#include "BLEDataHandler.h"
#include "LoRaInit.h"
#include "ControlTask.h"
#include "CloudDataHandler.h"
// main thread identifier (for signaling)
osThreadId mainThreadId = NULL;
int sig_continue = 0x1;
// data handler to configuration hanlder mailbox
Mail<Message_t, 16> MailBox;
Mail<Message_t, 16> ModbusMasterMailBox;
// local function prototypes
static void banner(void);
// for file system access outside of main()
mDot *GLOBAL_mdot;
// store modbus register information
std::map<std::string,ModbusRegister> ModbusRegisterMap;
/*****************************************************************************
* Function: banner()
* Description: Display the application boot banner
*
* @param none
* @return none
*****************************************************************************/
static void banner( void )
{
printf("\n\n\r\nWelcome to Project: ICE v0.0.2\n");
printf("\rThe Intelligent Connected Experience\n");
printf("\rCopyright 2016 Nalco Water, an Ecolab Company\n");
printf("\r\t _____ _____ ______ \n");
printf("\r\t |_ _| / ____| | ____|\n");
printf("\r\t | | | | | |__ \n");
printf("\r\t | | | | | __| \n");
printf("\r\t _| |_ | |____ | |____ \n");
printf("\r\t |_____| \\_____| |______|\n");
printf("\r\n\r\n\r\r\n");
}
/*****************************************************************************
* Function: banner()
* Description: Display the application boot banner
*
* @param none
* @return none
*****************************************************************************/
int main( void )
{
mDot *dot;
GLOBAL_mdot = dot = mDot::getInstance();
mDotRadioInit( dot );
// for signaling from the configuration handler
mainThreadId = osThreadGetId();
banner();
printf("\rMultiTech mDot library version: %s\n", dot->getId().c_str());
// start the configuration handler
Thread configHandler_thread(ConfigurationHandler);
Thread controlTask_thread(ControlTask);
// wait for the configuration handler to signal us
osSignalWait(sig_continue, osWaitForever);
printf("\r%s: continuing to initialize...\n", __func__);
Thread anaylticsLogger_thread(AnalyticsLogger);
Thread modbusMaster_thread(ModbusMaster);
Thread BLE_thread(BLEDataHandler);
Thread CDH_thread(CloudDataHandler);
Thread::wait(1000);
// display free memory on the heap
printf("\r\n");
__heapstats((__heapprt)fprintf,stdout);
printf("\r\n");
Thread::wait(1000);
printf("\r\n");
// start the command shell
ntshell_execute(&ntshell, func_read, func_write, func_cb_ntshell);
}
