The field version of the solarnano grid on the ionQubes
Fork of SolarNanoGridv3 by
Diff: SolarNanoGrid.cpp
- Revision:
- 2:929cf7fc6998
- Parent:
- 1:df924e0126d1
- Child:
- 3:350c167b9b2d
--- a/SolarNanoGrid.cpp Fri May 06 14:56:20 2016 +0000 +++ b/SolarNanoGrid.cpp Mon May 09 14:08:59 2016 +0000 @@ -33,14 +33,13 @@ #endif // Constructor: -SolarNanoGrid::SolarNanoGrid(SDFileSystem* sd){ +SolarNanoGrid::SolarNanoGrid(SDFileSystem* sd, DigitalOut* led_1, DigitalOut* led_2){ // Save the sd card pointer: _sd = sd; // initialize the SNG module: char * name = "/sd/config.ini"; FILE *fp; - spiSD(); mkdir("/sd/binData",777); mkdir("/sd/data",777); @@ -66,12 +65,13 @@ switch (role) { case('B'): case('b'): - SongBat = new battery(nrf1); - SongBat.initialiseBattery(fp); + SongBat = new battery(nrf1, nrf1Int, led_1, led_2); + SongBat->initialiseBattery(fp); break; case('L'): case('l'): - initialiseLocker(fp); + SongLock = new locker(nrf1, nrf1Int, led_1, led_2); + SongLock->initialiseLocker(fp); break; } @@ -82,7 +82,7 @@ { switch (role) { case('B'): { // Battery - loopBattery(); + SongBat->loop(); break; } case('M'): { // Master @@ -90,9 +90,26 @@ break; } case('L'): { // Locker - loopLocker(); + SongLock->loop(); break; } } } +// Turns SPI on for SD card +void SolarNanoGrid::spiSD(void) +{ + //sd.select(); + pin_function(PTE1 , 7); //Set SD_MISO as SPI, this is the same as the last number in those tables + pin_function(PTD7, 1); //pin function 1 is GPIO + return; +} + +void SolarNanoGrid::spiNrf(void) +{ + //sd.deselect(); + pin_function(PTE1, 1); //pin function 1 is GPIO + pin_function(PTD7, 7); //Set SD_MISO as SPI, this is the same as the last number in those tables + return; +} +