The field version of the solarnano grid on the ionQubes
Fork of SolarNanoGridv3 by
SolarNanoGrid.h
- Committer:
- defrost
- Date:
- 2016-06-02
- Revision:
- 6:93ca8321f83e
- Parent:
- 5:57b06b4b47c6
- Child:
- 7:5db9aeec9c2e
File content as of revision 6:93ca8321f83e:
/** *@section DESCRIPTION * mbed SolarNanogrid Library *@section LICENSE * Copyright (c) 2016, Malcolm McCulloch * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * @file "SolarNanoGrid.h" */ #ifndef SOLARNANOGRID_H #define SOLARNANOGRID_H #include <mbed.h> #include <pinmap.h> #include "NRF2401P.h" #include "SDFileSystem.h" #define FUNCNAME "SNGC" #include "defs.h" /** \brief A library for the base of the solar nano grid controllers. * * This library contains the code to drive batteries, hub etc. */ class SolarNanoGrid { public: // ********************* // * Public variables: * // ********************* int sdVersion=0; unsigned int id=0; unsigned int communityID=0; int chan=0; char dataRx[33]; char dataTx[33]; DigitalOut *ledRed=NULL, *ledGreen=NULL, *ledBlue=NULL; // ********************* // * Public functions: * // ********************* // Constructor: /** * Reads in config.ini and sets up the CommunityId, UserId, and the channel. */ SolarNanoGrid(FILE* fp); /** * Asks the user for the time and sets the real time clock */ void userSetRTCpc(); // Main loop function: void loop(void); // spi pin assignments: /** * Turns SPI on for SD card */ void spiSD(void); /** * Turns SPI on for nrf */ void spiNrf(void); protected: // ********************* // * Protected interrupts: * // ********************* InterruptIn* nrfInt; // ********************** // * Protected variables: * // ********************** DigitalOut* ce; FILE* _fp=NULL; NRF2401P* nrf=NULL; // ********************* // * Protected functions: * // ********************* /** * Flushes the rx and tx buffers and resets the status. */ void nrfFlush(); private: // ********************** // * Private variables: * // ********************** }; #endif /* SOLARNANOGRID_H */