LowPower
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
low_power::ArduinoLowPowerATTiny Class Reference

Low Power Management for ATTiny: More...

#include <LowPowerATTiny.h>

Inheritance diagram for low_power::ArduinoLowPowerATTiny:
Inheritance graph
[legend]

Public Member Functions

bool isProcessingOnSleep (sleep_mode_enum_t sleep_mode)
 you cant do any processing which we sleep
 
bool sleep (void) override
 sets processor into sleep mode
 
bool setSleepTime (uint32_t time, time_unit_t time_unit_type) override
 Defines the sleep time.
 
bool addWakeupPin (int pin, pin_change_t change_type) override
 Defines the wakup pin.
 
bool isModeSupported (sleep_mode_enum_t sleep_mode) override
 Provides information if the indicated mode is supported.
 
void clear ()
 reset the processing
 
virtual bool sleepFor (uint32_t time, time_unit_t time_unit_type)
 sets mc into sleep mode to sleep for indicated millis
 
virtual void setActive (bool flag)
 sets the flag to be active
 
virtual void setActiveTime (uint32_t time, time_unit_t time_unit_type)
 Defiles the active time.
 
virtual bool isActive ()
 Checks if we are active (not sleeping)
 
virtual operator bool ()
 same as isActive()
 
virtual bool setSleepMode (sleep_mode_enum_t mode)
 Defines the sleep mode.
 
virtual void process ()
 Triggers the processing to be active or sleeping based on the set definitions.
 
virtual bool isProcessingOnSleep ()
 Returns true if processing is possible in the current sleep mode.
 

Static Public Member Functions

static void processWatchdogCycle ()
 Called by watchdog interrupt.
 

Protected Member Functions

void setupWatchdog ()
 
int getTimeIdx (int ms)
 
void doDeepSleep ()
 
uint64_t toUs (uint64_t time, time_unit_t time_unit)
 

Static Protected Member Functions

static void pinWakupCB ()
 

Protected Attributes

int open_watchdog_cycle = 0
 
uint32_t sleep_time_us = 0
 
uint32_t pin_mask = 0
 
uint16_t timings_ms [8] = {15, 30, 60, 120, 250, 500, 1000, 2000}
 
bool is_active = true
 
uint32_t timeout_end = 0
 
uint32_t timeout_us = 0
 
time_unit_t time_unit = time_unit_t::ms
 
sleep_mode_enum_t sleep_mode = sleep_mode_enum_t::deepSleep
 

Detailed Description

Low Power Management for ATTiny:

Author
Phil Schatzmann see https://www.re-innovation.co.uk/docs/sleep-modes-on-attiny85/

The documentation for this class was generated from the following file: