m5stack / M5Core2

M5Core2 Arduino Library
MIT License
263 stars 115 forks source link

Fix DCDC2 voltage settings and improve voltage calculation #81

Closed trunneml closed 2 years ago

trunneml commented 2 years ago

To set the voltage of DCDC2 register 23H needs to be used, not 25H (see https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/AXP192_datasheet_cn.pdf). This PR will fix #82.

Also DCDC2 only has a range of 700mV to 2275 mV (6Bits). To prevent miss calculations for an out range value I added a helper method, that is used for LDO and DCDC voltage settings calculations.

trunneml commented 2 years ago

I rebased my PR to the latest master.