SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
AXP517Core.hpp
Go to the documentation of this file.
1
31#pragma once
32
33#include "../../../platform/comm/I2CDeviceWithHal.hpp"
34
43{
44public:
48 AXP517Core() = default;
49
50 ~AXP517Core() = default;
51
55 enum class Module : uint8_t {
56
58 BC12,
59 TYPEC,
60 GAUGE,
61 WATCHDOG,
62
65 BOOST,
66 BUCK,
67 CHGLED,
68 CHARGE,
69
70 MPPT,
71 };
72
81 bool enableModule(Module module, bool enable);
82
89 bool isModuleEnabled(Module module);
90
95 uint32_t millis()
96 {
97 return hal ? hal->millis() : 0;
98 }
99
104 void delayMs(uint32_t ms)
105 {
106 if (hal) {
107 hal->delay(ms);
108 }
109 }
110
116 void pinMode(uint8_t pin, uint8_t mode)
117 {
118 if (hal) {
119 hal->pinMode(pin, mode);
120 }
121 }
122
128 uint8_t digitalRead(uint8_t pin)
129 {
130 return hal ? hal->digitalRead(pin) : 1;
131 }
132
133private:
139 bool initImpl(uint8_t param) override;
140};
AXP517 low-level core driver.
uint8_t digitalRead(uint8_t pin)
Read a platform GPIO pin through the active HAL.
~AXP517Core()=default
uint32_t millis()
Return the current platform millisecond counter.
void pinMode(uint8_t pin, uint8_t mode)
Configure a platform GPIO pin through the active HAL.
AXP517Core()=default
Construct an uninitialized AXP517 core object.
bool isModuleEnabled(Module module)
Check if a module is enabled.
void delayMs(uint32_t ms)
Delay using the active platform HAL.
bool enableModule(Module module, bool enable)
Enable or disable a module.
Module
Functional module switches exposed by AXP517.
@ CHARGE
REG 19H bit 1 Charger.
@ BC12
Module enable control 0 (REG 0BH).
@ BUCK
REG 19H bit 3 Buck converter.
@ GAUGE
REG 0BH bit 2 Fuel gauge.
@ CHGLED
REG 19H bit 2 Charge LED.
@ TYPEC
REG 0BH bit 3 Type-C.
@ BOOST
REG 19H bit 4 Boost converter.
@ MPPT
REG 22H bit 0 MPPT configure.
@ WATCHDOG
REG 0BH bit 0 Watchdog CLK and REG 19H bit 0 Watchdog Module enable.
@ GAUGE_LOW_POWER
Module enable control 1 (REG 19H).
std::unique_ptr< SensorHal > hal