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: DmTftLibrary eeprom SX1280Lib filesystem mbed
Fork of MSNV2-Terminal_V1-5 by
Diff: Application.cpp
- Revision:
- 10:1b37e3b41947
- Parent:
- 8:cd489b7c49a0
- Child:
- 12:e9ec35413787
--- a/Application.cpp Wed Aug 22 13:08:56 2018 +0000
+++ b/Application.cpp Wed Aug 22 21:22:43 2018 +0000
@@ -10,16 +10,23 @@
#include "main.h"
#include "Application.h"
-#include "Tftlcd.h"
-#include "Lora.h"
+
#include "DataBase.h"
#include "Messages.h"
+#include "ExtMemory.h"
+
+#include "Tftlcd.h"
+#include "Lora.h"
#include "Sensor.h"
-static DataBase dataBase ; // Database creation
-//Tftlcd display ; // Display TFT access
+
+static DataBase dataBase ; // Database creation
static Messages messages ; // Messages Maker (Sensors, Config, Synchro ...)
-//Sensor sensor ;
+static ExtMemory extMemory ; // Memoire ext
+
+
+Tftlcd tftlcd ; // eventuellement a déplacer (uniquement valable sur les conf nucléo)
+Sensor sensor ; // eventuellement a déplacer
Application::Application() { // constructeur
@@ -33,7 +40,7 @@
void Application::start (){ // @brief Start the Application
initInterfaces () ; // Primary interface uart, i2c, spi ...
- readMemory () ; // Read memory to know the list of sensor availables
+ extMemory.read (&dataBase) ; // Read memory to know the list of sensor availables, fill DataBase
initSensors () ; // Depend of the list of sensors launch each
initActuators () ; // Depend of the list of actuator launch each
@@ -48,13 +55,67 @@
initLora ( freq, bw, sf, pwr ) ; // Initialise the radio module
- updateDisplay ( freq, bw, sf, pwr, bsz, time ) ; // Show information
+ printf( "*** APP *** start %ld %d %d %d %d %d \r\n",freq, bw, sf, pwr, bsz, time) ;
+
+ tftlcd.Update ( freq, bw, sf, pwr, bsz, time ) ; // Show information
- printf( "*** APP_ *** Start Application (Send message CONFIG)\r\n");
- //buildMessageGoodhealth () ;
+ printf( "*** APP_ *** Start Application (Send message GoodHealth)\r\n");
+ messages.buildGoodhealth () ;
//sendMessageLora () ;
}
+void Application::initInterfaces () {
+ // Depend of the configuration read on DataBase (memory origin)
+
+ debugSerial = new RawSerial (USBTX,USBRX, 230400); // Debug Link
+ tftlcd.Init () ;
+
+ // I2C, SPI, UART ....
+
+}
+
+
+void Application::initSensors(){
+ printf( "*** APPP *** initSensors \r\n");
+ // depend of the list identified (example)
+ //bme280 = new BME280(i2c_rt);
+ // depend of the list identified
+ //bme280->init(config->getBME280_MODE());
+}
+
+void Application::initActuators(){
+ // depend of the list identified (example)
+ //bme280 = new BME280(i2c_rt);
+ // depend of the list identified
+ //bme280->init(config->getBME280_MODE());
+}
+
+void Application::manageSensors () {
+ readSensors ();
+ messages.buildSensors () ;
+ sendMessage () ;
+}
+
+void Application::manageGoodhealth () {
+ readSensors ();
+ messages.buildGoodhealth () ;
+ //sendMessage () ;
+}
+
+void Application::manageSynchro () {
+ messages.buildSynchro () ;
+ //sendMessage () ;
+}
+
+void Application::manageConfiguration () {
+ messages.buildConfiguration () ;
+ //sendMessage () ;
+}
+
+void Application::manageListening () {
+}
+
+
void Application::getScheduling (uint16_t &TimerPayload, uint16_t &TimerGoodhealth, uint16_t &TimerSynchro, uint16_t &TimerListening ) {
TimerPayload = 1L ; // TODO Dépend de la lecture de la memoire (ici simulé)
@@ -63,86 +124,22 @@
TimerListening = 0L ;
}
-void Application::buildMessageSensors () { // read the queue and build the response
- printf( "*** APP_ *** buildMessageSensors \r\n");
- messages.buildMessageSensors () ;
- this->sensor.getTest () ;
-}
-/*
-void Application::buildMessageGoodhealth (uint8_t &message); { // read the queue and build the response
- printf( "*** APP_ *** BuildMessageConfig \r\n");
-}
-
-
-void Application::buildMessageSynchro (uint8_t &message); { // read the queue and build the response
- printf( "*** APP_ *** BuildMessageConfig \r\n");
-}
-*/
-
-void Application::sendMessage () {
+void Application::sendMessage () {
printf( "*** APP_ *** sendMessage \r\n");
sendMessageLora () ;
}
-
-void Application::initInterfaces () {
- // Depend of the configuration read on DataBase (memory origin)
-
- debugSerial = new RawSerial (USBTX,USBRX, 230400); // Debug Link
-
- display = new Display ; // Display TFT access
- display.Init () ;
-
- sensor = new Sensors () ;
-
-}
-
-void Application::setRadioParameterDataBase(){
- dataBase.setRadioParameter ( (uint32_t)2400000000UL, LORA_BW_0400, LORA_SF7, (int8_t)-18, (uint8_t)100, (uint16_t)2000) ;
- uint32_t freq ;
- RadioLoRaBandwidths_t bw ;
- RadioLoRaSpreadingFactors_t sf ;
- int8_t pwr ;
- uint8_t bsz ;
- int16_t time ;
- dataBase.getRadioParameter ( freq, bw, sf, pwr, bsz, time) ;
-}
-
-void Application::initSensors(){
- printf( "*** APPP *** initSensors \r\n");
- // depend of the list identified (example)
- //bme280 = new BME280(i2c_rt);
- // depend of the list identified
- //bme280->init(config->getBME280_MODE());
-}
-
-void Application::readSensors () {
+void Application::readSensors () {
printf( "*** APP_ *** readSensors \r\n");
// depend of the list identified
// Each sensor send can put a event in the db
}
-
-
-void Application::initActuators(){
- // depend of the list identified (example)
- //bme280 = new BME280(i2c_rt);
- // depend of the list identified
- //bme280->init(config->getBME280_MODE());
-}
-
void Application::writeActuators () {
// depend of the list identified
// Each sensor send can put a event in the queu
}
-void Application::updateDisplay (uint32_t freq,
- RadioLoRaBandwidths_t bw,
- RadioLoRaSpreadingFactors_t sf,
- int8_t pwr , uint8_t bsz, int16_t time ){
- display.Update ( sf, bw, pwr, bsz, freq, time ) ; //( LORA_SF, LORA_BW, TX_OUTPUT_POWER, BUFFER_SIZE_MAX, RF_FREQUENCY, TIMER )
-}
-
