|
SapFlow Probe
A low-cost HRM probe for measuring a tree's water consumption
|
#include <OPEnS_RTC.h>#include <LowPower.h>#include "pinout.h"#include "measure.h"#include "debug.h"Go to the source code of this file.
Functions | |
| void | alarmISR (void) |
| Interrupt handler for RTC alarm. More... | |
| void | feather_sleep (void) |
| Maximizes power savings during sleep. More... | |
| void | sleep_cycle (int interval=5) |
| Sleep function for periodic sleeping. More... | |
| int | schedule (struct pt *pt=&sched_thd) |
| Controls general measurement schedule. More... | |
Variables | |
| static struct pt | sched_thd |
| Protothread control structure for measure() | |
| static RTC_DS3231 | rtc_ds |
| Instance of our real-time clock. | |
| static bool | sleep |
| Global flag to prep for sleep. | |
| void alarmISR | ( | void | ) |
Interrupt handler for RTC alarm.
Called when the feather wakes up from sleep. Disables the RTC interrupt.
Definition at line 5 of file schedule.cpp.
| void feather_sleep | ( | void | ) |
Maximizes power savings during sleep.
Definition at line 13 of file schedule.cpp.
| int schedule | ( | struct pt * | pt = &sched_thd | ) |
Controls general measurement schedule.
This is the schedule:
| pt | A pointer to the protothread control structure. The default parameter is correct. Don't forget to initialize the control structure in setup(). |
Definition at line 81 of file schedule.cpp.
| void sleep_cycle | ( | int | interval = 5 | ) |
Sleep function for periodic sleeping.
Sleep until the time is a round multiple of the minute inteval. Produces unexpected bevahior for non-factors of 60 (7, 8, 9, 11, etc). For example, if it's 5:39 and you select an interval of 15, the microcontroller will wake up at 5:45, since 3*15 = 45. This function internally calls feather_sleep() to handle prep and resume from sleeping
| interval | The increment to sleep for. |
Definition at line 67 of file schedule.cpp.