reef monitor
Dependencies: mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed
Fork of HTTPServerHelloWorld by
Revision 10:372c882b5533, committed 2014-03-02
- Comitter:
- wyunreal
- Date:
- Sun Mar 02 18:15:47 2014 +0000
- Parent:
- 9:8f1dce5f85fe
- Child:
- 11:9366140ebe5f
- Commit message:
- integrating microchip io expander
Changed in this revision
--- a/HardwareDrivers/MCP23S17.lib Sun Mar 02 12:44:28 2014 +0000 +++ b/HardwareDrivers/MCP23S17.lib Sun Mar 02 18:15:47 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/romilly/code/MCP23S17/#068b1e8909bb +http://mbed.org/users/romilly/code/MCP23S17/#ca0429a15915
--- a/HardwareDrivers/SDFileSystem.lib Sun Mar 02 12:44:28 2014 +0000 +++ b/HardwareDrivers/SDFileSystem.lib Sun Mar 02 18:15:47 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/simon/code/SDFileSystem/#93796e8ed42f +http://mbed.org/users/simon/code/SDFileSystem/#498b360ea482
--- a/Model/Application.cpp Sun Mar 02 12:44:28 2014 +0000 +++ b/Model/Application.cpp Sun Mar 02 18:15:47 2014 +0000 @@ -22,9 +22,18 @@ // set the system time from NTP ethernetService->setRtcTime(); - // starting the file system + // start spi + spiHandler = new SPI(p5, p6, p7); + spiHandler->frequency(100000); // 100 khz for slow periperals intialization + + // starting the file systems localFileSystem = new LocalFileSystem("local"); - sdFileSystem = new SDFileSystem(p5, p6, p7, p8, "sd"); + sdFileSystem = new SDFileSystem(spiHandler, p8, "sd"); + + // starting the external actuators control group + actuatorsController = new ActuatorsController(spiHandler); + + spiHandler->frequency(4000000); // 4 Mhz spi normal operation frequency // start the rest api server restServer = new RestServer(localFileSystem, sdFileSystem);
--- a/Model/Application.h Sun Mar 02 12:44:28 2014 +0000 +++ b/Model/Application.h Sun Mar 02 18:15:47 2014 +0000 @@ -5,14 +5,18 @@ #include "RestServer.h" #include "SDFileSystem.h" #include "WatchDogTimer.h" +#include "ActuatorsController.h" class Application { private: + SPI *spiHandler; + WatchDogTimer* watchDog; EthernetService* ethernetService; RestServer* restServer; FileSystemLike* localFileSystem; FileSystemLike* sdFileSystem; + ActuatorsController* actuatorsController; void setup(); void loop();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Services/Actuators/ActuatorsController.cpp Sun Mar 02 18:15:47 2014 +0000 @@ -0,0 +1,10 @@ +#include "ActuatorsController.h" + +ActuatorsController::ActuatorsController(SPI* spiHandler){ + char ioPortAddress = 0x40; + ioPort = new MCP23S17(spiHandler, p20, ioPortAddress); + + // all 16 bits as output + ioPort->direction(PORT_A, 0x00); + ioPort->direction(PORT_B, 0x00); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Services/Actuators/ActuatorsController.h Sun Mar 02 18:15:47 2014 +0000 @@ -0,0 +1,15 @@ +#ifndef ACTUATORS_CONTROLLER_H +#define ACTUATORS_CONTROLLER_H + +#include "mbed.h" +#include "MCP23S17.h" + +class ActuatorsController { + private: + MCP23S17* ioPort; + public: + ActuatorsController(SPI* spiHandler); + +}; + +#endif \ No newline at end of file