The field version of the solarnano grid on the ionQubes
Fork of SolarNanoGridv3 by
SolarNanoGrid.h
- Committer:
- defrost
- Date:
- 2016-06-10
- Revision:
- 13:de43f28c0365
- Parent:
- 11:87ab310924f0
- Child:
- 15:e719c1cb0ea2
File content as of revision 13:de43f28c0365:
/** *@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 <RawSerial.h> #include "NRF2401P.h" #include "SDFileSystem.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; unsigned int id; unsigned int communityID; int chan; char dataRx[33]; char dataTx[33]; Serial *pc; DigitalOut *ledRed, *ledGreen, *ledBlue; // ********************* // * Public functions: * // ********************* // Constructor: /** * Reads in config.ini and sets up the CommunityId, UserId, and the channel. */ SolarNanoGrid(FILE* fp, Serial *pc); /** * Asks the user for the time and sets the real time clock */ void userSetRTCpc(); // Main loop function: virtual void loop(void) = 0; // 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; NRF2401P* nrf; // ********************* // * Protected functions: * // ********************* /** * Flushes the rx and tx buffers and resets the status. */ void nrfFlush(); /** * Set NRF as RX and flush */ void setAsRX(long long addr); /** * Sets NRF as TX and flushes the NRF */ void setAsTX(long long addr); private: // ********************** // * Private variables: * // ********************** }; #endif /* SOLARNANOGRID_H */