|
Plant Watering Sensor
|
This module is the interface to the Hardware via GPIO, ADC and Counter. More...
Enumerations | |
| enum | LedState : uint8_t { LED_Off = 0x00u, LED_Green = 0x01u, LED_Red = 0x02u } |
| The state of the current display (LED). More... | |
Functions | |
| void | setup () |
| Setup the MCU hardware to the initial values. More... | |
| void | setLedState (LedState ledState) |
| Enable or disable the status LEDs. More... | |
| void | sendDoneSignal () |
| Send the done signal. More... | |
| bool | isButtonPressed () |
| Get the status of the button. More... | |
| uint16_t | getVoltageValue () |
| Read the current voltage value. More... | |
| void | shutdownVoltageMeasurement () |
| Shutdown voltage measurement to save power. More... | |
| uint8_t | getOscillatorFrequency () |
| Try to determine the frequency. More... | |
| void | shutdownOscillatorCounter () |
| Shutdown the counter to save power. More... | |
This module is the interface to the Hardware via GPIO, ADC and Counter.
| enum Hardware::LedState : uint8_t |
The state of the current display (LED).
| Enumerator | |
|---|---|
| LED_Off | The LED is off. |
| LED_Green | The green LED is on. |
| LED_Red | The red LED is on. |
Definition at line 34 of file Hardware.h.
| uint8_t Hardware::getOscillatorFrequency | ( | ) |
Try to determine the frequency.
I assume the frequency from the oscillator will be somewhere in a kHz range. The maximum frequency of the oscillator is somewhere around 140kHz the lowest (100% water) around 40kHz. Measuring the number of rising edges for ~1ms should generate a usable value.
If no signal is received, 0x00 is returned. If the counter overflows, 0xff is returned. (This should not happen).
Definition at line 136 of file Hardware.cpp.
| uint16_t Hardware::getVoltageValue | ( | ) |
Read the current voltage value.
Definition at line 105 of file Hardware.cpp.
| bool Hardware::isButtonPressed | ( | ) |
Get the status of the button.
Definition at line 99 of file Hardware.cpp.
| void Hardware::sendDoneSignal | ( | ) |
Send the done signal.
Definition at line 89 of file Hardware.cpp.
| void Hardware::setLedState | ( | LedState | ledState | ) |
Enable or disable the status LEDs.
| ledState | The LED state. |
Definition at line 69 of file Hardware.cpp.
| void Hardware::setup | ( | ) |
| void Hardware::shutdownOscillatorCounter | ( | ) |
Shutdown the counter to save power.
After calling this method, the getOscillatorFrequency() call will not work anymore.
Definition at line 156 of file Hardware.cpp.
| void Hardware::shutdownVoltageMeasurement | ( | ) |
Shutdown voltage measurement to save power.
Definition at line 128 of file Hardware.cpp.