/** * Author : Anatole SCHRAMM-HENRY * Created the : 30/05/2021 * This classe exposes all the methods necessary to init the WSPeripherals (Weather Station Peripherals) and * to retrieve various data and measurements like battery voltage, Temperatures etc... */ #ifndef WSPERIPHERALS_H #define WSPERIPHERALS_H #include #include #include #include #include "BoardConfig.h" class WSPeripherals { public: enum State {OFF, ON}; WSPeripherals(const BoardConfig &boardConfig); /* * Returns 7 if all the external devices are working properly, or an other value if it is not the case. */ uint8_t init(); /* * After calling this methode , you need to execute initExternalPeripherals() to init the peripherals. */ void externalPeripherals(State state){_3V3PowerRail(state);} /* * Used to init devices after each LDO powerup, external devices need to be turned one externalPeripherals(ON) before calling this function. */ uint8_t initExternalPeripherals(); float batteryVoltage(); int sunlightMeasurement(); float temperatureFromBMP280(); float ATMPressure(); float temperatureFromHTU21(); float humidity(); float compensatedHumidity(); /* * Before calling this method, externalPeripherals(ON) and initExternalPeripherals() must be called respectively */ void applyRadioConfig(uint8_t channel, uint8_t paLevel, rf24_datarate_e datarate) { _NRF.setChannel(channel); _NRF.setPALevel(paLevel); _NRF.setDataRate(rf24_datarate_e); } const RF24 &getRadio(); protected: private: void _3V3PowerRail(State state); const BoardConfig &_boardConfig; const Adafruit_BMP280 _BMP280; const HTU21D _HTU21; const RF24 _NRF; }; #endif //WSPERIPHERALS_H