Initial public release of WII5 Buoy firmware
Firmware for an autonomous wave-measurement buoy (ATmega2560-based WII5 v2 board). Reads wave motion from a Sparton AHRS-M1/M2 IMU, samples GPS and battery state, and reports back over Iridium SBD satellite telemetry. Originally developed 2012-2024. This is the first public release. Code, documentation, and field-tested operating modes (Capture, Sleep, Position, ManualTest, SelfTest, LowBattery) are licensed under Apache 2.0 — see LICENSE and NOTICE. See README.md for an overview and build instructions, CONTRIBUTING.md for how to contribute, and DEPLOYMENTS.md for the field-deployment log.
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
|
||||
//
|
||||
// This file is part of WII5 Buoy firmware.
|
||||
// See LICENSE for full terms.
|
||||
|
||||
/**
|
||||
* @file WII5Power.h
|
||||
* @brief Base class for power-managed peripherals (powerOn/powerOff state).
|
||||
*/
|
||||
|
||||
#ifndef WII5Power_h
|
||||
#define WII5Power_h
|
||||
|
||||
#include <elapsedMillis.h>
|
||||
|
||||
class WII5Power : public WII5 {
|
||||
public:
|
||||
WII5Power() {
|
||||
powerData_Pin = 0; powerData_PinOff = 0; powerData_Pulse = 0; powerData_OnIsHigh = false;
|
||||
powerData_On = false; powerData_Elapsed = 0; powerData_Last = 0; powerData_LastTotal = 0;
|
||||
powerData_Input = true;
|
||||
}
|
||||
virtual WII5_DRIVERS driverId() {return WII5DRIVER_POWER;}
|
||||
void powerSetPin(uint8_t p, bool onHigh = true, uint8_t pOff = 0, uint8_t pulse = 0);
|
||||
void powerSetShared(WII5Power *s);
|
||||
virtual void powerOn(bool force = false);
|
||||
virtual void powerOff(bool force = false);
|
||||
virtual void powerInput();
|
||||
bool powerStatus();
|
||||
uint32_t powerLast();
|
||||
uint32_t powerElapsed();
|
||||
uint32_t powerLastTotal();
|
||||
|
||||
protected:
|
||||
// PIN and which way high
|
||||
uint8_t powerData_Pin;
|
||||
uint8_t powerData_PinOff; // If this is set, assume Pin to turn on, PinOff to turn off
|
||||
uint8_t powerData_Pulse; // Numbers of 10s of milliseconds, from 10 to 2550
|
||||
bool powerData_OnIsHigh;
|
||||
|
||||
// Shared pin - see WII5PowerShared (note it can just be a PIN but Shared counts)
|
||||
WII5Power *powerData_Shared;
|
||||
|
||||
// Current status
|
||||
bool powerData_On;
|
||||
bool powerData_Input; // Pin is currently input - e.g. bootup or sleep
|
||||
|
||||
// How long since on (millisecond timer, not effected by time changes)
|
||||
elapsedMillis powerData_Elapsed;
|
||||
|
||||
// Actual time truned on (effected by tim echange)
|
||||
time_t powerData_Last;
|
||||
|
||||
// Number of seconds it was on for
|
||||
uint32_t powerData_LastTotal;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user