| 4 | } |
| 5 | |
| 6 | void AXP192::begin(void) { |
| 7 | Wire1.begin(21, 22); |
| 8 | Wire1.setClock(400000); |
| 9 | |
| 10 | // Set LDO2 & LDO3(TFT_LED & TFT) 3.0V |
| 11 | Write1Byte(0x28, 0xcc); |
| 12 | |
| 13 | // Set ADC to All Enable |
| 14 | Write1Byte(0x82, 0xff); |
| 15 | |
| 16 | // Bat charge voltage to 4.2, Current 100MA |
| 17 | Write1Byte(0x33, 0xc0); |
| 18 | |
| 19 | // Enable Bat,ACIN,VBUS,APS adc |
| 20 | Write1Byte(0x82, 0xff); |
| 21 | |
| 22 | // Enable Ext, LDO2, LDO3, DCDC1 |
| 23 | Write1Byte(0x12, Read8bit(0x12) | 0x4D); |
| 24 | |
| 25 | // 128ms power on, 4s power off |
| 26 | Write1Byte(0x36, 0x0C); |
| 27 | |
| 28 | // Set RTC voltage to 3.3V |
| 29 | Write1Byte(0x91, 0xF0); |
| 30 | |
| 31 | // Set GPIO0 to LDO |
| 32 | Write1Byte(0x90, 0x02); |
| 33 | |
| 34 | // Disable vbus hold limit |
| 35 | Write1Byte(0x30, 0x80); |
| 36 | |
| 37 | // Set temperature protection |
| 38 | Write1Byte(0x39, 0xfc); |
| 39 | |
| 40 | // Enable RTC BAT charge |
| 41 | Write1Byte(0x35, 0xa2); |
| 42 | |
| 43 | // Enable bat detection |
| 44 | Write1Byte(0x32, 0x46); |
| 45 | |
| 46 | // ScreenBreath(80); |
| 47 | } |
| 48 | |
| 49 | void AXP192::Write1Byte(uint8_t Addr, uint8_t Data) { |
| 50 | Wire1.beginTransmission(0x34); |
nothing calls this directly
no outgoing calls
no test coverage detected