SparkFun_smol_Power_Board_Arduino_Library
Macros | Enumerations
SparkFun_smol_Power_Board_Constants.h File Reference

Go to the source code of this file.

Macros

#define I2C_BUFFER_LENGTH   32
 
#define SFE_SMOL_POWER_DEFAULT_I2C_ADDRESS   0x50
 
#define SFE_SMOL_POWER_ADC_READ_DELAY   15
 The ADC read (eight samples, averaged) takes ~11ms to complete at 4MHz. 15ms provides margin. More...
 
#define SFE_SMOL_POWER_EEPROM_UPDATE_DELAY   6
 The eeprom update takes ~4ms to complete at 4MHz. 6ms provides margin.
 
#define SFE_SMOL_POWER_RESET_REASON_PORF_BIT   0
 Bit position of the Power-on Reset Flag. More...
 
#define SFE_SMOL_POWER_RESET_REASON_PORF   (1 << SFE_SMOL_POWER_RESET_REASON_PORF_BIT)
 Flag to indicate if the MCUSR PORF Flag was set when the ATtiny43U came out of reset.
 
#define SFE_SMOL_POWER_RESET_REASON_EXTRF_BIT   1
 Bit position of the External Reset Flag.
 
#define SFE_SMOL_POWER_RESET_REASON_EXTRF   (1 << SFE_SMOL_POWER_RESET_REASON_EXTRF_BIT)
 Flag to indicate if the MCUSR EXTRF Flag was set when the ATtiny43U came out of reset.
 
#define SFE_SMOL_POWER_RESET_REASON_BORF_BIT   2
 Bit position of the Brown-out Reset Flag.
 
#define SFE_SMOL_POWER_RESET_REASON_BORF   (1 << SFE_SMOL_POWER_RESET_REASON_BORF_BIT)
 Flag to indicate if the MCUSR BORF Flag was set when the ATtiny43U came out of reset.
 
#define SFE_SMOL_POWER_RESET_REASON_WDRF_BIT   3
 Bit position of the Watchdog Reset Flag.
 
#define SFE_SMOL_POWER_RESET_REASON_WDRF   (1 << SFE_SMOL_POWER_RESET_REASON_WDRF_BIT)
 Flag to indicate if the MCUSR WDRF Flag was set when the ATtiny43U came out of reset.
 
#define SFE_SMOL_POWER_EEPROM_CORRUPT_ON_RESET_BIT   4
 Bit position of the eeprom memory corrupt on reset flag.
 
#define SFE_SMOL_POWER_EEPROM_CORRUPT_ON_RESET   (1 << SFE_SMOL_POWER_EEPROM_CORRUPT_ON_RESET_BIT)
 Flag to indicate if the ATtiny43U's eeprom memory was corrupt on reset and has been overwritten with the default settings.
 
#define SFE_SMOL_POWER_COMM_ERROR_BIT   7
 Bit position of the communication error flag.
 
#define SFE_SMOL_POWER_COMM_ERROR   (1 << SFE_SMOL_POWER_COMM_ERROR_BIT)
 Flag to indicate if a communication error occurred while fetching the reset reason.
 

Enumerations

enum  sfe_power_board_registers_e {
  SFE_SMOL_POWER_REGISTER_I2C_ADDRESS = 0x00 , SFE_SMOL_POWER_REGISTER_RESET_REASON , SFE_SMOL_POWER_REGISTER_TEMPERATURE , SFE_SMOL_POWER_REGISTER_VBAT ,
  SFE_SMOL_POWER_REGISTER_1V1 , SFE_SMOL_POWER_REGISTER_ADC_REFERENCE , SFE_SMOL_POWER_REGISTER_WDT_PRESCALER , SFE_SMOL_POWER_REGISTER_POWERDOWN_DURATION ,
  SFE_SMOL_POWER_REGISTER_POWERDOWN_NOW , SFE_SMOL_POWER_REGISTER_FIRMWARE_VERSION
}
 
enum  sfe_power_board_ADC_ref_e { SFE_SMOL_POWER_USE_ADC_REF_VCC = 0 , SFE_SMOL_POWER_USE_ADC_REF_1V1 , SFE_SMOL_POWER_USE_ADC_REF_UNDEFINED }
 
enum  sfe_power_board_WDT_prescale_e {
  SFE_SMOL_POWER_WDT_TIMEOUT_16ms = 0 , SFE_SMOL_POWER_WDT_TIMEOUT_32ms , SFE_SMOL_POWER_WDT_TIMEOUT_64ms , SFE_SMOL_POWER_WDT_TIMEOUT_125ms ,
  SFE_SMOL_POWER_WDT_TIMEOUT_250ms , SFE_SMOL_POWER_WDT_TIMEOUT_500ms , SFE_SMOL_POWER_WDT_TIMEOUT_1s , SFE_SMOL_POWER_WDT_TIMEOUT_2s ,
  SFE_SMOL_POWER_WDT_TIMEOUT_4s , SFE_SMOL_POWER_WDT_TIMEOUT_8s , SFE_SMOL_POWER_WDT_TIMEOUT_UNDEFINED
}
 

Detailed Description

SparkFun smôl Power Board Arduino Library

This library facilitates communication with the smôl Power Board over I2C.

Want to support open source hardware? Buy a board from SparkFun!
SparkX smôl Power Board LiPo (SPX-18622): https://www.sparkfun.com/products/18622
SparkX smôl Power Board AAA (SPX-18621): https://www.sparkfun.com/products/18621
SparkX smôl ESP32 (SPX-18619): https://www.sparkfun.com/products/18619

This library was written by: Paul Clark SparkFun Electronics July 23rd 2021

Please see LICENSE.md for the license information

Macro Definition Documentation

◆ SFE_SMOL_POWER_ADC_READ_DELAY

#define SFE_SMOL_POWER_ADC_READ_DELAY   15

The ADC read (eight samples, averaged) takes ~11ms to complete at 4MHz. 15ms provides margin.

delay durations for the ADC read and eeprom update

◆ SFE_SMOL_POWER_RESET_REASON_PORF_BIT

#define SFE_SMOL_POWER_RESET_REASON_PORF_BIT   0

Bit position of the Power-on Reset Flag.

getResetReason will return these bits

Enumeration Type Documentation

◆ sfe_power_board_ADC_ref_e

Allow the user to select either VCC or the internal 1.1V reference as the reference for VBAT ADC measurements

◆ sfe_power_board_registers_e

The addresses of the registers within the ATtiny43U's memory

◆ sfe_power_board_WDT_prescale_e

The Watchdog Timer Prescale select