CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
BQ25895Power.cpp File Reference
#include "cdc_hal/IPowerManager.h"
#include "cdc_hal/II2cBus.h"
#include "cdc_hal/hw_config.h"
#include "cdc_log.h"
#include "esp_attr.h"
#include "esp_timer.h"
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

Go to the source code of this file.

Classes

class  cdc::hal::BQ25895Power

Namespaces

namespace  cdc
namespace  cdc::hal

Functions

static void cdc::hal::charger_isr (void *arg)
 GPIO interrupt handler for the charger IRQ pin.
IPowerManagercdc::hal::getPowerManagerInstance ()
 Returns the singleton power manager instance.

Variables

static const char * TAG = "BQ25895"
static constexpr uint8_t cdc::hal::BQ_REG_INPUT_CTRL = 0x00
 BQ25895 register map constants.
static constexpr uint8_t cdc::hal::BQ_REG_ADC_CTRL = 0x02
static constexpr uint8_t cdc::hal::BQ_REG_CHG_CTRL = 0x03
static constexpr uint8_t cdc::hal::BQ_REG_FAST_CHG = 0x04
static constexpr uint8_t cdc::hal::BQ_REG_TIMER = 0x07
static constexpr uint8_t cdc::hal::BQ_REG_MISC = 0x09
static constexpr uint8_t cdc::hal::BQ_REG_SYS_STATUS = 0x0B
static constexpr uint8_t cdc::hal::BQ_REG_FAULT = 0x0C
static constexpr uint8_t cdc::hal::BQ_REG_BATV = 0x0E
static constexpr uint8_t cdc::hal::BQ_REG_SYSV = 0x0F
static constexpr uint8_t cdc::hal::BQ_REG_TS = 0x10
static constexpr uint8_t cdc::hal::BQ_REG_VBUS = 0x11
static constexpr uint8_t cdc::hal::BQ_REG_ICHG = 0x12
static constexpr uint8_t cdc::hal::BQ_REG_VINDPM = 0x13
static constexpr uint8_t cdc::hal::BQ_REG_VENDOR = 0x14
static constexpr uint8_t cdc::hal::BQ_ICHG_STEP_MA = 64
 Charge current and safety threshold constants.
static constexpr uint16_t cdc::hal::BQ_SYS_MIN_MV = 3300
static constexpr uint16_t cdc::hal::CHARGE_CURRENT_SLOW = 512
static constexpr uint16_t cdc::hal::CHARGE_CURRENT_FAST = 1000
static constexpr uint16_t cdc::hal::CHARGE_CURRENT_MIN = 64
static constexpr uint16_t cdc::hal::CHARGE_CURRENT_MAX = 1024
static constexpr uint16_t cdc::hal::BATTERY_MIN_MV = 2800
 Battery voltage thresholds for state estimation. LiPo battery characteristics (3.7V nominal, 4.2V max).
static constexpr uint16_t cdc::hal::BATTERY_EMPTY_MV = 3200
static constexpr uint16_t cdc::hal::BATTERY_FULL_MV = 4200
static constexpr uint16_t cdc::hal::BATTERY_MAX_MV = 4250
static constexpr uint16_t cdc::hal::BATTERY_USB_PASSTHRU_MIN_MV = 4000
static constexpr uint16_t cdc::hal::BATTERY_USB_PASSTHRU_MAX_MV = BATTERY_MAX_MV
static constexpr uint32_t cdc::hal::kPowerButtonLongPressMs = 3000
 Hold duration on the power/flash button that triggers ship mode.
static volatile bool cdc::hal::charger_irq_pending = false
 Charger IRQ flag set by ISR and consumed in update().
static BQ25895Power cdc::hal::g_powerManager
 Singleton power manager instance.

Variable Documentation

◆ TAG

const char* TAG = "BQ25895"
static

BQ25895 Power Manager HAL Implementation Based on cdc-badge-os-legacy/components/cdc_badge/power_management.cpp

Applies safe defaults on every boot (charger has no persistent storage). Supports fast charging up to 1000mA for the 1200mAh LiPo battery.

Definition at line 19 of file BQ25895Power.cpp.