🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5StickC AXP I2C

    SOFTWARE
    3
    3
    8.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BSCULLEY
      last edited by

      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?

      1 Reply Last reply Reply Quote 1
      • D
        dda
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • O
          Oliv'
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post