SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
AXP1xxCore.hpp
Go to the documentation of this file.
1
30#pragma once
31#include <stdint.h>
32
33namespace axp1xx
34{
35
40 uint8_t reg;
41 uint8_t bit;
42};
43
47struct CoreConfig {
48 uint8_t chipIdReg;
49 uint8_t chipIdValue;
50 uint8_t i2cAddress;
51 struct {
53 uint8_t count;
55};
56
64inline const ModuleEntry *findEntry(const ModuleEntry *table, uint8_t count, uint8_t index)
65{
66 if (index >= count) return nullptr;
67 return &table[index];
68}
69
70} // namespace axp1xx
const ModuleEntry * findEntry(const ModuleEntry *table, uint8_t count, uint8_t index)
Look up a module entry by index.
Chip configuration metadata.
struct axp1xx::CoreConfig::@1 modules
uint8_t chipIdValue
Expected chip ID value.
uint8_t count
Number of entries in the table.
uint8_t chipIdReg
Register address for chip ID.
const ModuleEntry * table
Pointer to module entry table.
uint8_t i2cAddress
I2C slave address.
Register-bit pair identifying a power module.
uint8_t bit
Bit position within the register.
uint8_t reg
Register address.