SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
AXP1xxIrq.hpp
Go to the documentation of this file.
1
53#pragma once
54#include "../../PmicIrqBase.hpp"
55#include "../../../platform/SensorCommWrapper.hpp"
56
57template<typename Regs>
58class AXP1xxIrq : public PmicIrqBase
59{
60public:
61 // ========================================================================
62 // INTSTS1 -> bits 0-7 (STATUS1: AXP192=REG44H, AXP202=REG48H)
63 // All shared [AXP192+AXP202]
64 // ========================================================================
66 static constexpr uint64_t IRQ_ACIN_OV = (1ULL << 7);
68 static constexpr uint64_t IRQ_ACIN_INSERT = (1ULL << 6);
70 static constexpr uint64_t IRQ_ACIN_REMOVE = (1ULL << 5);
72 static constexpr uint64_t IRQ_VBUS_OV = (1ULL << 4);
74 static constexpr uint64_t IRQ_VBUS_INSERT = (1ULL << 3);
76 static constexpr uint64_t IRQ_VBUS_REMOVE = (1ULL << 2);
78 static constexpr uint64_t IRQ_VBUS_LOW_VHOLD = (1ULL << 1);
79
80 // ========================================================================
81 // INTSTS2 -> bits 8-15 (STATUS2: AXP192=REG45H, AXP202=REG49H)
82 // All shared [AXP192+AXP202]
83 // ========================================================================
85 static constexpr uint64_t IRQ_BAT_INSERT = (1ULL << 15);
87 static constexpr uint64_t IRQ_BAT_REMOVE = (1ULL << 14);
89 static constexpr uint64_t IRQ_BAT_ENTER_ACTIVATE = (1ULL << 13);
91 static constexpr uint64_t IRQ_BAT_EXIT_ACTIVATE = (1ULL << 12);
93 static constexpr uint64_t IRQ_BAT_CHG_START = (1ULL << 11);
95 static constexpr uint64_t IRQ_BAT_CHG_DONE = (1ULL << 10);
97 static constexpr uint64_t IRQ_BAT_TEMP_HIGH = (1ULL << 9);
99 static constexpr uint64_t IRQ_BAT_TEMP_LOW = (1ULL << 8);
100
101 // ========================================================================
102 // INTSTS3 -> bits 16-23 (STATUS3: AXP192=REG46H, AXP202=REG4AH)
103 // ========================================================================
105 static constexpr uint64_t IRQ_CHIP_OV_TEMP = (1ULL << 23);
107 static constexpr uint64_t IRQ_CHG_CURR_LESS = (1ULL << 22);
117 static constexpr uint64_t IRQ_DC1_VOLT_LESS = (1ULL << 21);
119 static constexpr uint64_t IRQ_DC2_VOLT_LESS = (1ULL << 20);
121 static constexpr uint64_t IRQ_DC3_VOLT_LESS = (1ULL << 19);
122 // NOTE: STATUS3 bit 2 is Reserved on both AXP192 (REG46H[2]) and
123 // AXP202 (REG4AH[2]).
125 static constexpr uint64_t IRQ_PEKEY_SHORT_PRESS = (1ULL << 17);
127 static constexpr uint64_t IRQ_PEKEY_LONG_PRESS = (1ULL << 16);
128
129 // ========================================================================
130 // INTSTS4 -> bits 24-31 (STATUS4: AXP192=REG47H, AXP202=REG4BH)
131 // ========================================================================
133 static constexpr uint64_t IRQ_NOE_POWERON = (1ULL << 31);
135 static constexpr uint64_t IRQ_NOE_POWERDOWN = (1ULL << 30);
137 static constexpr uint64_t IRQ_VBUS_EFFECTIVE = (1ULL << 29);
139 static constexpr uint64_t IRQ_VBUS_INVALID = (1ULL << 28);
141 static constexpr uint64_t IRQ_VBUS_SESSION = (1ULL << 27);
143 static constexpr uint64_t IRQ_VBUS_SESSION_END = (1ULL << 26);
145 static constexpr uint64_t IRQ_LOW_VOLT_LEVEL1 = (1ULL << 25);
147 static constexpr uint64_t IRQ_LOW_VOLT_LEVEL2 = (1ULL << 24);
148
149 // ========================================================================
150 // INTSTS5 -> bits 32-39 (STATUS5: AXP192=REG4DH, AXP202=REG4CH)
151 // ========================================================================
153 static constexpr uint64_t IRQ_GPIO0_EDGE = (1ULL << 32);
155 static constexpr uint64_t IRQ_GPIO1_EDGE = (1ULL << 33);
157 static constexpr uint64_t IRQ_GPIO2_EDGE = (1ULL << 34);
159 static constexpr uint64_t IRQ_GPIO3_EDGE = (1ULL << 35);
161 static constexpr uint64_t IRQ_PKEY_NEGATIVE = (1ULL << 37);
163 static constexpr uint64_t IRQ_PKEY_POSITIVE = (1ULL << 38);
165 static constexpr uint64_t IRQ_TIMER_TIMEOUT = (1ULL << 39);
166
168 static constexpr uint64_t IRQ_ALL_MASK = 0xFFFFFFFFFFULL;
169
170 // *INDENT-OFF*
177 static bool isIrqSet(uint64_t irqMask, uint64_t status) { return (status & irqMask) != 0; }
178
179 // ========================================================================
180 // INTSTS1 interrupt check functions [AXP192+AXP202]
181 // ========================================================================
183 static bool isAcinOv(uint64_t m) { return isIrqSet(IRQ_ACIN_OV, m); }
185 static bool isAcinInsert(uint64_t m) { return isIrqSet(IRQ_ACIN_INSERT, m); }
187 static bool isAcinRemove(uint64_t m) { return isIrqSet(IRQ_ACIN_REMOVE, m); }
189 static bool isVbusOv(uint64_t m) { return isIrqSet(IRQ_VBUS_OV, m); }
191 static bool isVbusInsert(uint64_t m) { return isIrqSet(IRQ_VBUS_INSERT, m); }
193 static bool isVbusRemove(uint64_t m) { return isIrqSet(IRQ_VBUS_REMOVE, m); }
195 static bool isVbusLowVhold(uint64_t m) { return isIrqSet(IRQ_VBUS_LOW_VHOLD, m); }
196
197 // ========================================================================
198 // INTSTS2 interrupt check functions [AXP192+AXP202]
199 // ========================================================================
201 static bool isBatInsert(uint64_t m) { return isIrqSet(IRQ_BAT_INSERT, m); }
203 static bool isBatRemove(uint64_t m) { return isIrqSet(IRQ_BAT_REMOVE, m); }
205 static bool isBatEnterActivate(uint64_t m) { return isIrqSet(IRQ_BAT_ENTER_ACTIVATE, m); }
207 static bool isBatExitActivate(uint64_t m) { return isIrqSet(IRQ_BAT_EXIT_ACTIVATE, m); }
209 static bool isBatChgStart(uint64_t m) { return isIrqSet(IRQ_BAT_CHG_START, m); }
211 static bool isBatChgDone(uint64_t m) { return isIrqSet(IRQ_BAT_CHG_DONE, m); }
213 static bool isBatTempHigh(uint64_t m) { return isIrqSet(IRQ_BAT_TEMP_HIGH, m); }
215 static bool isBatTempLow(uint64_t m) { return isIrqSet(IRQ_BAT_TEMP_LOW, m); }
216
217 // ========================================================================
218 // INTSTS3 interrupt check functions [AXP192+AXP202]
219 // ========================================================================
221 static bool isChipOvTemp(uint64_t m) { return isIrqSet(IRQ_CHIP_OV_TEMP, m); }
223 static bool isChgCurrLess(uint64_t m) { return isIrqSet(IRQ_CHG_CURR_LESS, m); }
225 static bool isDc1VoltLess(uint64_t m) { return isIrqSet(IRQ_DC1_VOLT_LESS, m); }
227 static bool isDc2VoltLess(uint64_t m) { return isIrqSet(IRQ_DC2_VOLT_LESS, m); }
229 static bool isDc3VoltLess(uint64_t m) { return isIrqSet(IRQ_DC3_VOLT_LESS, m); }
231 static bool isPekeyShortPress(uint64_t m) { return isIrqSet(IRQ_PEKEY_SHORT_PRESS, m); }
233 static bool isPekeyLongPress(uint64_t m) { return isIrqSet(IRQ_PEKEY_LONG_PRESS, m); }
234
235 // ========================================================================
236 // INTSTS4 interrupt check functions
237 // ========================================================================
239 static bool isNoePoweron(uint64_t m) { return isIrqSet(IRQ_NOE_POWERON, m); }
241 static bool isNoePowerdown(uint64_t m) { return isIrqSet(IRQ_NOE_POWERDOWN, m); }
243 static bool isVbusEffective(uint64_t m) { return isIrqSet(IRQ_VBUS_EFFECTIVE, m); }
245 static bool isVbusInvalid(uint64_t m) { return isIrqSet(IRQ_VBUS_INVALID, m); }
247 static bool isVbusSession(uint64_t m) { return isIrqSet(IRQ_VBUS_SESSION, m); }
249 static bool isVbusSessionEnd(uint64_t m) { return isIrqSet(IRQ_VBUS_SESSION_END, m); }
251 static bool isLowVoltLevel2(uint64_t m) { return isIrqSet(IRQ_LOW_VOLT_LEVEL2, m); }
253 static bool isLowVoltLevel1(uint64_t m) { return isIrqSet(IRQ_LOW_VOLT_LEVEL1, m); }
254
255 // ========================================================================
256 // INTSTS5 interrupt check functions
257 // ========================================================================
259 static bool isGpio0EdgeTrigger(uint64_t m) { return isIrqSet(IRQ_GPIO0_EDGE, m); }
261 static bool isGpio1EdgeTrigger(uint64_t m) { return isIrqSet(IRQ_GPIO1_EDGE, m); }
263 static bool isGpio2EdgeTrigger(uint64_t m) { return isIrqSet(IRQ_GPIO2_EDGE, m); }
265 static bool isGpio3EdgeTrigger(uint64_t m) { return isIrqSet(IRQ_GPIO3_EDGE, m); }
267 static bool isPkeyNegative(uint64_t m) { return isIrqSet(IRQ_PKEY_NEGATIVE, m); }
269 static bool isPkeyPositive(uint64_t m) { return isIrqSet(IRQ_PKEY_POSITIVE, m); }
271 static bool isTimerTimeout(uint64_t m) { return isIrqSet(IRQ_TIMER_TIMEOUT, m); }
272
273 // ========================================================================
274 // AXP192 naming aliases (legacy XPowersLib compatibility)
275 // ========================================================================
277 static bool isAcinOverVol(uint64_t m) { return isAcinOv(m); }
279 static bool isAcinConnect(uint64_t m) { return isAcinInsert(m); }
281 static bool isVbusOverVol(uint64_t m) { return isVbusOv(m); }
283 static bool isVbusVholdLow(uint64_t m) { return isVbusLowVhold(m); }
285 static bool isBattActivate(uint64_t m) { return isBatEnterActivate(m); }
287 static bool isBattExitActivate(uint64_t m) { return isBatExitActivate(m); }
289 static bool isBattOverTemp(uint64_t m) { return isBatTempHigh(m); }
291 static bool isBattLowTemp(uint64_t m) { return isBatTempLow(m); }
293 static bool isChipTempHigh(uint64_t m) { return isChipOvTemp(m); }
295 static bool isChargeLowCur(uint64_t m) { return isChgCurrLess(m); }
297 static bool isDc1LowVol(uint64_t m) { return isDc1VoltLess(m); }
299 static bool isDc2LowVol(uint64_t m) { return isDc2VoltLess(m); }
301 static bool isDc3LowVol(uint64_t m) { return isDc3VoltLess(m); }
303 // static bool isPkeyShortPress(uint64_t m) { return isPekeyShortPress(m); }
305 // static bool isPkeyLongPress(uint64_t m) { return isPekeyLongPress(m); }
307 static bool isNoeOn(uint64_t m) { return isNoePoweron(m); }
309 static bool isNoeOff(uint64_t m) { return isNoePowerdown(m); }
311 static bool isVbusValid(uint64_t m) { return isVbusEffective(m); }
313 static bool isVbusSessionAB(uint64_t m) { return isVbusSession(m); }
315 static bool isApsLowVolLevel(uint64_t m) { return isLowVoltLevel2(m); }
317 static bool isGpio0Irq(uint64_t m) { return isGpio0EdgeTrigger(m); }
319 static bool isGpio1Irq(uint64_t m) { return isGpio1EdgeTrigger(m); }
321 static bool isGpio2Irq(uint64_t m) { return isGpio2EdgeTrigger(m); }
323 static bool isTimerIrq(uint64_t m) { return isTimerTimeout(m); }
324
325 // ========================================================================
326 // AXP202 naming aliases (legacy XPowersLib compatibility)
327 // ========================================================================
329 static bool isApsLowVolLevel1(uint64_t m) { return isLowVoltLevel1(m); }
331 static bool isGpio3Irq(uint64_t m) { return isGpio3EdgeTrigger(m); }
332
333 // *INDENT-ON*
334
339 explicit AXP1xxIrq(SensorCommWrapper &core) : _core(core) {}
340
350 bool enable(uint64_t mask) override;
351
361 bool disable(uint64_t mask) override;
362
374 uint64_t readStatus(bool clear = true) override;
375
384 bool clearStatus() override;
385
386private:
392 bool readEnableRegs(uint8_t buf[5]);
393
401 bool writeEnableRegsIfChanged(const uint8_t before[5], const uint8_t after[5]);
402
409 bool clearStatusByMask(const uint8_t maskBytes[5]);
410
415 bool clearAllStatusRegs();
416
422 static uint64_t pack5(const uint8_t buf[5]);
423
429 static void unpack5(uint64_t val, uint8_t buf[5]);
430
431 SensorCommWrapper &_core;
432};
433
434template<typename Regs>
436{
437 if (_core.readRegBuff(Regs::irq::ENABLE1, buf, 4) < 0) {
438 return false;
439 }
440
441 int en5 = _core.readReg(Regs::irq::ENABLE5);
442 if (en5 < 0) {
443 return false;
444 }
445 buf[4] = static_cast<uint8_t>(en5);
446 return true;
447}
448
449template<typename Regs>
450bool AXP1xxIrq<Regs>::writeEnableRegsIfChanged(const uint8_t before[5], const uint8_t after[5])
451{
452 // Warning: It cannot be optimized to continuous writing, otherwise an error will occur.
453 for (int i = 0; i < 4; ++i) {
454 if (before[i] != after[i]) {
455 if (_core.writeReg(Regs::irq::ENABLE1 + i, after[i]) < 0) {
456 return false;
457 }
458 }
459 }
460
461 if (before[4] != after[4]) {
462 if (_core.writeReg(Regs::irq::ENABLE5, after[4]) < 0) {
463 return false;
464 }
465 }
466 return true;
467}
468
469template<typename Regs>
470bool AXP1xxIrq<Regs>::clearStatusByMask(const uint8_t maskBytes[5])
471{
472 // Warning: It cannot be optimized to continuous writing, otherwise an error will occur.
473 for (int i = 0; i < 4; ++i) {
474 if (maskBytes[i] != 0) {
475 if (_core.writeReg(Regs::irq::STATUS1 + i, maskBytes[i]) < 0) {
476 return false;
477 }
478 }
479 }
480
481 if (maskBytes[4] != 0) {
482 if (_core.writeReg(Regs::irq::STATUS5, maskBytes[4]) < 0) {
483 return false;
484 }
485 }
486 return true;
487}
488
489template<typename Regs>
491{
492 const uint8_t all[5] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
493 return clearStatusByMask(all);
494}
495
496template<typename Regs>
497inline uint64_t AXP1xxIrq<Regs>::pack5(const uint8_t buf[5])
498{
499 return (static_cast<uint64_t>(buf[0])) |
500 (static_cast<uint64_t>(buf[1]) << 8) |
501 (static_cast<uint64_t>(buf[2]) << 16) |
502 (static_cast<uint64_t>(buf[3]) << 24) |
503 (static_cast<uint64_t>(buf[4]) << 32);
504}
505
506template<typename Regs>
507inline void AXP1xxIrq<Regs>::unpack5(uint64_t val, uint8_t buf[5])
508{
509 buf[0] = static_cast<uint8_t>(val & 0xFF);
510 buf[1] = static_cast<uint8_t>((val >> 8) & 0xFF);
511 buf[2] = static_cast<uint8_t>((val >> 16) & 0xFF);
512 buf[3] = static_cast<uint8_t>((val >> 24) & 0xFF);
513 buf[4] = static_cast<uint8_t>((val >> 32) & 0xFF);
514}
515
516template<typename Regs>
517bool AXP1xxIrq<Regs>::enable(uint64_t mask)
518{
519 uint8_t before[5], after[5];
520 if (!readEnableRegs(before)) {
521 return false;
522 }
523
524 uint64_t current = pack5(before);
525 current |= mask;
526 unpack5(current, after);
527
528 return writeEnableRegsIfChanged(before, after);
529}
530
531template<typename Regs>
532bool AXP1xxIrq<Regs>::disable(uint64_t mask)
533{
534 uint8_t before[5], after[5];
535 if (!readEnableRegs(before)) {
536 return false;
537 }
538
539 uint64_t current = pack5(before);
540 current &= ~mask;
541 unpack5(current, after);
542
543 return writeEnableRegsIfChanged(before, after);
544}
545
546template<typename Regs>
547uint64_t AXP1xxIrq<Regs>::readStatus(bool clear)
548{
549 uint8_t buf[5];
550 if (_core.readRegBuff(Regs::irq::STATUS1, buf, 4) < 0) {
551 return 0;
552 }
553 int st5 = _core.readReg(Regs::irq::STATUS5);
554 if (st5 < 0) return 0;
555 buf[4] = static_cast<uint8_t>(st5);
556
557 uint64_t mask = pack5(buf);
558 if (clear && mask != 0) {
559 // W1C safe: only write back the bits that were actually read,
560 // so newly arrived interrupts between read and clear are preserved.
561 if (!clearStatusByMask(buf)) {
562 return 0;
563 }
564 }
565 return mask;
566}
567
568template<typename Regs>
570{
571 return clearAllStatusRegs();
572}
static bool isGpio1EdgeTrigger(uint64_t m)
Check GPIO1 edge trigger interrupt.
static bool isBattExitActivate(uint64_t m)
AXP192 alias for isBatExitActivate().
static bool isDc2VoltLess(uint64_t m)
Check DC-DC2 voltage low interrupt.
static bool isVbusSessionEnd(uint64_t m)
Check VBUS session end interrupt.
static constexpr uint64_t IRQ_VBUS_LOW_VHOLD
VBUS low VHOLD interrupt mask.
Definition AXP1xxIrq.hpp:78
static constexpr uint64_t IRQ_VBUS_SESSION_END
VBUS session end interrupt mask.
static bool isGpio3Irq(uint64_t m)
AXP202 alias for isGpio3EdgeTrigger().
static bool isApsLowVolLevel1(uint64_t m)
AXP202 alias for isLowVoltLevel1().
static constexpr uint64_t IRQ_VBUS_EFFECTIVE
VBUS effective interrupt mask.
static constexpr uint64_t IRQ_GPIO0_EDGE
GPIO0 edge trigger interrupt mask.
static constexpr uint64_t IRQ_BAT_CHG_START
Charging started interrupt mask.
Definition AXP1xxIrq.hpp:93
static bool isAcinInsert(uint64_t m)
Check ACIN insertion interrupt.
static constexpr uint64_t IRQ_VBUS_INSERT
VBUS insertion interrupt mask.
Definition AXP1xxIrq.hpp:74
static bool isBatChgStart(uint64_t m)
Check charging started interrupt.
static bool isDc1LowVol(uint64_t m)
AXP192 alias for isDc1VoltLess().
static constexpr uint64_t IRQ_LOW_VOLT_LEVEL2
Low voltage level 2 interrupt mask.
static constexpr uint64_t IRQ_ACIN_INSERT
ACIN insertion interrupt mask.
Definition AXP1xxIrq.hpp:68
static bool isNoeOff(uint64_t m)
AXP192 alias for isNoePowerdown().
static bool isBattActivate(uint64_t m)
AXP192 alias for isBatEnterActivate().
static constexpr uint64_t IRQ_DC2_VOLT_LESS
DC-DC2 voltage less than target interrupt mask.
static bool isNoePowerdown(uint64_t m)
Check N-oe power-down interrupt.
static bool isVbusOv(uint64_t m)
Check VBUS overvoltage interrupt.
static bool isAcinConnect(uint64_t m)
AXP192 alias for isAcinInsert().
bool clearStatus() override
Clear all pending interrupt status registers.
static bool isTimerIrq(uint64_t m)
AXP192 alias for isTimerTimeout().
static bool isBatChgDone(uint64_t m)
Check charging completed interrupt.
static bool isIrqSet(uint64_t irqMask, uint64_t status)
Check if a specific interrupt is set in a status mask.
static bool isBatTempLow(uint64_t m)
Check battery temperature low interrupt.
static bool isPekeyShortPress(uint64_t m)
Check PEK short press interrupt.
static constexpr uint64_t IRQ_PKEY_NEGATIVE
PEK press falling edge interrupt mask.
static constexpr uint64_t IRQ_BAT_ENTER_ACTIVATE
Battery entered active mode interrupt mask.
Definition AXP1xxIrq.hpp:89
static constexpr uint64_t IRQ_GPIO3_EDGE
GPIO3 edge trigger interrupt mask.
static constexpr uint64_t IRQ_CHIP_OV_TEMP
Chip overtemperature interrupt mask.
static bool isVbusSessionAB(uint64_t m)
AXP192 alias for isVbusSession().
static constexpr uint64_t IRQ_GPIO1_EDGE
GPIO1 edge trigger interrupt mask.
static bool isLowVoltLevel2(uint64_t m)
Check low voltage level 2 interrupt.
static bool isDc1VoltLess(uint64_t m)
Check DC-DC1 voltage low interrupt.
static bool isBatRemove(uint64_t m)
Check battery removal interrupt.
static bool isGpio0EdgeTrigger(uint64_t m)
Check GPIO0 edge trigger interrupt.
static constexpr uint64_t IRQ_DC3_VOLT_LESS
DC-DC3 voltage less than target interrupt mask.
static bool isPkeyNegative(uint64_t m)
Check PEK press falling edge interrupt.
static constexpr uint64_t IRQ_DC1_VOLT_LESS
DC-DC1 voltage less than target interrupt mask.
static bool isBattOverTemp(uint64_t m)
AXP192 alias for isBatTempHigh().
static bool isDc3VoltLess(uint64_t m)
Check DC-DC3 voltage low interrupt.
static bool isVbusValid(uint64_t m)
AXP192 alias for isVbusEffective().
static bool isChipTempHigh(uint64_t m)
AXP192 alias for isChipOvTemp().
static bool isGpio2Irq(uint64_t m)
AXP192 alias for isGpio2EdgeTrigger().
static bool isVbusInvalid(uint64_t m)
Check VBUS invalid interrupt.
static bool isApsLowVolLevel(uint64_t m)
AXP192 alias for isLowVoltLevel2().
static bool isBatExitActivate(uint64_t m)
Check battery exited active mode interrupt.
static constexpr uint64_t IRQ_NOE_POWERON
N-oe power-on interrupt mask.
static constexpr uint64_t IRQ_PEKEY_SHORT_PRESS
PEK short press interrupt mask.
static constexpr uint64_t IRQ_CHG_CURR_LESS
Charge current less than target interrupt mask.
bool disable(uint64_t mask) override
Disable one or more interrupt sources.
static bool isBatTempHigh(uint64_t m)
Check battery temperature high interrupt.
static bool isVbusRemove(uint64_t m)
Check VBUS removal interrupt.
static constexpr uint64_t IRQ_BAT_REMOVE
Battery removal interrupt mask.
Definition AXP1xxIrq.hpp:87
static bool isGpio3EdgeTrigger(uint64_t m)
Check GPIO3 edge trigger interrupt.
static bool isPekeyLongPress(uint64_t m)
Check PEK long press interrupt.
static bool isGpio0Irq(uint64_t m)
AXP192 alias for isGpio0EdgeTrigger().
static constexpr uint64_t IRQ_NOE_POWERDOWN
N-oe power-down interrupt mask.
static bool isVbusInsert(uint64_t m)
Check VBUS insertion interrupt.
static bool isVbusOverVol(uint64_t m)
AXP192 alias for isVbusOv().
static bool isDc3LowVol(uint64_t m)
AXP192 alias for isDc3VoltLess().
static bool isAcinOv(uint64_t m)
Check ACIN overvoltage interrupt.
static constexpr uint64_t IRQ_GPIO2_EDGE
GPIO2 edge trigger interrupt mask.
static constexpr uint64_t IRQ_BAT_CHG_DONE
Charging completed interrupt mask.
Definition AXP1xxIrq.hpp:95
static bool isVbusVholdLow(uint64_t m)
AXP192 alias for isVbusLowVhold().
static constexpr uint64_t IRQ_VBUS_OV
VBUS overvoltage interrupt mask.
Definition AXP1xxIrq.hpp:72
static bool isVbusSession(uint64_t m)
Check VBUS session request interrupt.
static constexpr uint64_t IRQ_VBUS_INVALID
VBUS invalid interrupt mask.
static bool isGpio2EdgeTrigger(uint64_t m)
Check GPIO2 edge trigger interrupt.
static constexpr uint64_t IRQ_BAT_INSERT
Battery insertion interrupt mask.
Definition AXP1xxIrq.hpp:85
static bool isAcinOverVol(uint64_t m)
AXP192 alias for isAcinOv().
static bool isChargeLowCur(uint64_t m)
AXP192 alias for isChgCurrLess().
static bool isPkeyPositive(uint64_t m)
Check PEK press rising edge interrupt.
static bool isGpio1Irq(uint64_t m)
AXP192 alias for isGpio1EdgeTrigger().
static bool isBatInsert(uint64_t m)
Check battery insertion interrupt.
static bool isChipOvTemp(uint64_t m)
Check chip overtemperature interrupt.
bool enable(uint64_t mask) override
Enable one or more interrupt sources.
static constexpr uint64_t IRQ_VBUS_REMOVE
VBUS removal interrupt mask.
Definition AXP1xxIrq.hpp:76
static constexpr uint64_t IRQ_VBUS_SESSION
VBUS session request interrupt mask.
static constexpr uint64_t IRQ_ACIN_REMOVE
ACIN removal interrupt mask.
Definition AXP1xxIrq.hpp:70
static bool isVbusEffective(uint64_t m)
Check VBUS effective interrupt.
static constexpr uint64_t IRQ_LOW_VOLT_LEVEL1
Low voltage level 1 interrupt mask.
static bool isBattLowTemp(uint64_t m)
AXP192 alias for isBatTempLow().
static constexpr uint64_t IRQ_ALL_MASK
Mask covering all defined interrupt sources (bits 1-39).
AXP1xxIrq(SensorCommWrapper &core)
Construct interrupt controller interface.
static constexpr uint64_t IRQ_BAT_TEMP_LOW
Battery temperature low interrupt mask.
Definition AXP1xxIrq.hpp:99
static constexpr uint64_t IRQ_BAT_EXIT_ACTIVATE
Battery exited active mode interrupt mask.
Definition AXP1xxIrq.hpp:91
static constexpr uint64_t IRQ_ACIN_OV
ACIN overvoltage interrupt mask.
Definition AXP1xxIrq.hpp:66
static bool isAcinRemove(uint64_t m)
Check ACIN removal interrupt.
static constexpr uint64_t IRQ_TIMER_TIMEOUT
Timer timeout interrupt mask.
static constexpr uint64_t IRQ_PKEY_POSITIVE
PEK press rising edge interrupt mask.
static constexpr uint64_t IRQ_BAT_TEMP_HIGH
Battery temperature high interrupt mask.
Definition AXP1xxIrq.hpp:97
static bool isLowVoltLevel1(uint64_t m)
Check low voltage level 1 interrupt.
static bool isNoeOn(uint64_t m)
AXP192 alias for isPekeyShortPress().
static bool isTimerTimeout(uint64_t m)
Check timer timeout interrupt.
static bool isNoePoweron(uint64_t m)
Check N-oe power-on interrupt.
static bool isVbusLowVhold(uint64_t m)
Check VBUS low VHOLD interrupt.
static bool isBatEnterActivate(uint64_t m)
Check battery entered active mode interrupt.
uint64_t readStatus(bool clear=true) override
Read and optionally clear interrupt status.
static bool isDc2LowVol(uint64_t m)
AXP192 alias for isDc2VoltLess().
static constexpr uint64_t IRQ_PEKEY_LONG_PRESS
PEK long press interrupt mask.
static bool isChgCurrLess(uint64_t m)
Check charge current less than target interrupt.
uint8_t i
char buf[64]