M5StickC AXP I2C



  • Is there any documentation of the I2C memory mapping and usage for the ASP192?

    I have found a reference in Axp.GetBtnPress() that writes to 0x46. What is at this address (or any address for that matter)?

    What button is associated with the AXP192?



  • The datasheet has most of the registers explained. I have the Chinese version, so it requires a little squinting (my Chinese is ok but nowhere near the level required to read datasheets with a smile pasted on my face ;-).

    However I recently spent some quality time with the source code and the datasheet, so I have that more or less nailed down.

    0_1564857639385_084f8473-5542-4879-9369-06395cf83b15-image.png

    Register 46H is IRQ Status 3. Bits 0/1 are for the button:

    // 0 not press, 0x01 long press, 0x02 press
    uint8_t AXP192::GetBtnPress() {
      Wire1.beginTransmission(0x34);
      Wire1.write(0x46);
      Wire1.endTransmission();
      Wire1.requestFrom(0x34, 1);
      uint8_t state = Wire1.read();
      if (state) {
        Wire1.beginTransmission(0x34);
        Wire1.write(0x46);
        Wire1.write(0x03);
        Wire1.endTransmission();
      }
      return state;
    }
    

    In Wire1.write(0x03); 0x03 is the two bits 0 and 1 set.

    There are many more registers, and the best would be to get a datasheet in English and read the registers description.



  • Hi, you can find the datasheet here. It is in Chinese but Google translate does a pretty decent job so we can understand almost everything.

    You can also have a look a register 36h where you can modify long/short press times. Be careful, this button is used to power-on/off the device