Wombat Environmental Node 1.0
An environmental node for SDI-12 and digital sensors.
Loading...
Searching...
No Matches
main.cpp File Reference
#include <Arduino.h>
#include "version.h"
#include <esp_log.h>
#include <freertos/FreeRTOS.h>
#include <TCA9534.h>
#include <driver/rtc_io.h>
#include <soc/rtc.h>
#include <esp_private/esp_clk.h>
#include <SD.h>
#include <esp_ota_ops.h>
#include <SPIFFS.h>
#include "globals.h"
#include "SensorTask.h"
#include "DeviceConfig.h"
#include "cli/CLI.h"
#include "peripherals.h"
#include "audio-feedback/tones.h"
#include "uplinks.h"
#include "ulp.h"
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
#include "sd-card/interface.h"
#include "freertos/semphr.h"
#include "esp_partition.h"
#include "ota_update.h"
#include "ftp_stack.h"
#include "power_monitoring/battery.h"
#include "power_monitoring/solar.h"
#include "Utils.h"
Include dependency graph for main.cpp:

Macros

#define ALLOCATE_GLOBALS
 
#define TAG   "wombat"
 
#define SLOW_CLK_CAL_CYCLES   2048
 

Functions

static void select_rtc_slow_clk (void)
 Switch the RTC clock source to the external crystal. More...
 
void timeout_task (void *pvParameters)
 
void setup (void)
 
void shutdown (void)
 
void loop ()
 
void digitalWrite (uint8_t pin, uint8_t val)
 Allow digitalWrite to be used for pins on the IO expander. More...
 

Variables

TCA9534 io_expander
 
bool spiffs_ok = false
 
static volatile int uxTopUsedPriority
 
static TaskHandle_t xHandle = nullptr
 

Macro Definition Documentation

◆ ALLOCATE_GLOBALS

#define ALLOCATE_GLOBALS

◆ SLOW_CLK_CAL_CYCLES

#define SLOW_CLK_CAL_CYCLES   2048

◆ TAG

#define TAG   "wombat"

Function Documentation

◆ digitalWrite()

void digitalWrite ( uint8_t  pin,
uint8_t  val 
)

Allow digitalWrite to be used for pins on the IO expander.

This function overrides the default digitalWrite provided by the Arduino core so we can use it with pins on the IO expander IC. If the pin number > 0x80 then the bits > 0x80 are masked off and the request is sent to the IO expander library.

For example, passing in pin 0x82 will ask the IO expander library to write to its pin 2.

Parameters
pinthe GPIO to write to; values > 0x80 will be handled by the IO expander library after masking off the bits > 0x80. @val HIGH or LOW

◆ loop()

void loop ( )

◆ select_rtc_slow_clk()

void select_rtc_slow_clk ( void  )
static

Switch the RTC clock source to the external crystal.

This code is copied from the ESP32 Ardiuno core, and slightly modified so it only tries to use the external crystal before falling back to the 150 kHz internal oscillator.

◆ setup()

void setup ( void  )

◆ shutdown()

void shutdown ( void  )

◆ timeout_task()

void timeout_task ( void *  pvParameters)

A simple timeout task. Runs on core 0 so the app code does not interfere with it.

If 14 minutes passes and timeout_restart has not been set to false, power to the modem is shut off and the ESP32 is rebooted.

Parameters
pvParametersnot used.

Variable Documentation

◆ io_expander

TCA9534 io_expander

◆ spiffs_ok

bool spiffs_ok = false

◆ uxTopUsedPriority

volatile int uxTopUsedPriority
static

◆ xHandle

TaskHandle_t xHandle = nullptr
static