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: MPU6050 Grove_temperature
ControlImpl.cpp@15:11e13881c385, 2019-07-15 (annotated)
- Committer:
- AndersonIctus
- Date:
- Mon Jul 15 21:41:01 2019 -0300
- Revision:
- 15:11e13881c385
- Parent:
- 14:5ab232a10f33
- Child:
- 17:8789ab4067a6
- revisao dos sensores
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AndersonIctus | 1:f21c2f775f15 | 1 | #include "sgam_mdw.h" |
AndersonIctus | 3:f67352c85fd7 | 2 | #include "mbed.h" |
AndersonIctus | 3:f67352c85fd7 | 3 | |
AndersonIctus | 0:681d98ff3681 | 4 | #include "ControlImpl.h" |
AndersonIctus | 3:f67352c85fd7 | 5 | #include "Temperature.h" |
AndersonIctus | 5:fa36c3288be8 | 6 | #include "Gyroscope.h" |
AndersonIctus | 14:5ab232a10f33 | 7 | #include "LoRaWanComm.h" |
AndersonIctus | 3:f67352c85fd7 | 8 | |
AndersonIctus | 6:806043bf1a2c | 9 | ControlImpl::ControlImpl() { |
AndersonIctus | 15:11e13881c385 | 10 | I2C i2c(I2C_SDA, I2C_SCL); |
AndersonIctus | 7:8db3e62ac4e2 | 11 | // Incluindo os Protocolos |
AndersonIctus | 7:8db3e62ac4e2 | 12 | // includeSensor( new Protocol() ) |
AndersonIctus | 7:8db3e62ac4e2 | 13 | |
AndersonIctus | 7:8db3e62ac4e2 | 14 | // Incluindo os Sensores |
AndersonIctus | 7:8db3e62ac4e2 | 15 | includeSensor( (Sensor<void*>*) new Temperature(A1) ); |
AndersonIctus | 7:8db3e62ac4e2 | 16 | includeSensor( (Sensor<void*>*) new Gyroscope(i2c) ); |
AndersonIctus | 7:8db3e62ac4e2 | 17 | |
AndersonIctus | 7:8db3e62ac4e2 | 18 | // Incluindo Comunicacoes |
AndersonIctus | 15:11e13881c385 | 19 | includeCommunication( (Communication<void*>*)new LoRaWanComm("") ); |
AndersonIctus | 6:806043bf1a2c | 20 | } |
AndersonIctus | 3:f67352c85fd7 | 21 | |
AndersonIctus | 6:806043bf1a2c | 22 | ControlImpl::~ControlImpl() { |
AndersonIctus | 3:f67352c85fd7 | 23 | } |
AndersonIctus | 3:f67352c85fd7 | 24 | |
AndersonIctus | 1:f21c2f775f15 | 25 | void ControlImpl::initialize() { |
AndersonIctus | 3:f67352c85fd7 | 26 | // possiveis inicializacoes no sistema ! |
AndersonIctus | 6:806043bf1a2c | 27 | D_LOG("Inicializando o Controler !\r\n"); |
AndersonIctus | 6:806043bf1a2c | 28 | |
AndersonIctus | 6:806043bf1a2c | 29 | // INICIALIZANDO ... |
AndersonIctus | 6:806043bf1a2c | 30 | // protocolos ... |
AndersonIctus | 7:8db3e62ac4e2 | 31 | // for (std::map<std::string, Protocol*>::iterator it=mp_protocols.begin(); it!=mp_protocols.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 32 | // it->second->initialize(); |
AndersonIctus | 6:806043bf1a2c | 33 | |
AndersonIctus | 7:8db3e62ac4e2 | 34 | // // sensores ... |
AndersonIctus | 7:8db3e62ac4e2 | 35 | // for (std::map<std::string, Sensor<void*>*>::iterator it=mp_sensors.begin(); it!=mp_sensors.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 36 | // it->second->initialize(); |
AndersonIctus | 6:806043bf1a2c | 37 | |
AndersonIctus | 7:8db3e62ac4e2 | 38 | // // comunicacoes ... |
AndersonIctus | 7:8db3e62ac4e2 | 39 | // for (std::map<std::string, Communication<void*>*>::iterator it=mp_communications.begin(); it!=mp_communications.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 40 | // it->second->initialize(); |
AndersonIctus | 3:f67352c85fd7 | 41 | } |
AndersonIctus | 1:f21c2f775f15 | 42 | |
AndersonIctus | 3:f67352c85fd7 | 43 | void ControlImpl::finalize() { |
AndersonIctus | 7:8db3e62ac4e2 | 44 | // // comunicacoes ... |
AndersonIctus | 7:8db3e62ac4e2 | 45 | // for (std::map<std::string, Communication<void*>*>::iterator it=mp_communications.begin(); it!=mp_communications.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 46 | // it->second->finalize(); |
AndersonIctus | 7:8db3e62ac4e2 | 47 | |
AndersonIctus | 7:8db3e62ac4e2 | 48 | // // sensores ... |
AndersonIctus | 7:8db3e62ac4e2 | 49 | // for (std::map<std::string, Sensor<void*>*>::iterator it=mp_sensors.begin(); it!=mp_sensors.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 50 | // it->second->finalize(); |
AndersonIctus | 7:8db3e62ac4e2 | 51 | |
AndersonIctus | 7:8db3e62ac4e2 | 52 | // // protocolos ... |
AndersonIctus | 7:8db3e62ac4e2 | 53 | // for (std::map<std::string, Protocol*>::iterator it=mp_protocols.begin(); it!=mp_protocols.end(); ++it) |
AndersonIctus | 7:8db3e62ac4e2 | 54 | // it->second->finalize(); |
AndersonIctus | 3:f67352c85fd7 | 55 | } |
AndersonIctus | 1:f21c2f775f15 | 56 | |
AndersonIctus | 7:8db3e62ac4e2 | 57 | // metodo de instancia unica |
AndersonIctus | 1:f21c2f775f15 | 58 | Control* ControlImpl::getControler() { |
AndersonIctus | 1:f21c2f775f15 | 59 | return this; |
AndersonIctus | 1:f21c2f775f15 | 60 | } |