SapFlow Probe
A low-cost HRM probe for measuring a tree's water consumption
|
#include "pinout.h"
#include "schedule.h"
#include "measure.h"
Go to the source code of this file.
◆ loop()
Implicit loop.
This function is called inside a hidden loop in the Arduino framework. We're using it for protothread scheduling. All the real work happens inside the protothreads.
Definition at line 47 of file sapflow_protothread.ino.
◆ setup()
One-time initialization.
This function is called when the microcontroller first starts up or is reset. It's good for things that should only happen once. You do not need to call it yourself. It initializes some hardware, puts the protothreads in a known state, and begins the measurement cycle (which starts with sleep)
Definition at line 12 of file sapflow_protothread.ino.
16 Serial.println(
"Serial connected");
28 pinMode(
EN_5v, OUTPUT);
35 digitalWrite(
EN_5v, HIGH);
38 pinMode(
SD_CS, OUTPUT);
static struct pt measure_thd
Protothread control structure for measure()
@ I2C_SCL
I2C clock pin. Pull-up.
static struct pt baseline_thd
Protothread control structure for baseline()
@ EN_5v
Control pin for 5v Power rail. Output, Active-high.
@ STATUS_LED
Built-in LED on feather. Active-high.
@ EN_3v3
Control pin for 3.3V power rail. Output, Active-low.
static struct pt sched_thd
Protothread control structure for measure()
int sample_timer(struct pt *pt)
Controls timing of the measurements.
@ SPI_MOSI
SPI data pin. Output.
void init(int period)
Initialize the watchdog at the period given.
int measure(struct pt *pt)
Captures a measurement from the three probes.
static SdFat sd
File system object.
@ HEATER
Control pin for heater switch. Output, Active-high.
@ RFM95_CS
SPI chip select used for LoRa. Output, Active-low.
static class FunctionMarker halt_location
Singleton of our debug class.
static struct pt delta_thd
Protothread control structure for delta()
static struct pt sample_timer_thd
Protothread control structure for sample_timer()
int schedule(struct pt *pt)
Controls general measurement schedule.
static bool sleep
Global flag to prep for sleep.
@ I2C_SDA
I2C data pin. Pull-up.
@ SPI_SCK
SPI clock pin. Output.
@ SD_CS
SPI chip select for SD card. Output, Active-low.