Another basic question: how do the APIs interact?

  • The docs at are divided into various APIs: CORE API, CORE2 API, PAPER API etc.

    A very basic question: when programming an M5 Paper, is the PAPER API the only one available?

    I sort of assumed it would be, because of the overlaps. But then I noticed that the example for SetAlarmIRQ on contains a call to M5.Axp.PowerOff();, which isn't covered in the PAPER API docs:

    void loop() {
      M5.Lcd.setCursor(0, 15);
      M5.Lcd.printf("Time: %02d : %02d : %02d/n",TimeStruct.Hours, TimeStruct.Minutes, TimeStruct.Seconds);
        M5.Lcd.println("M5Core2 Will Close, Restore After 5 seconds ");

    So can we use any of the M5 APIs? Or is there some that we can use on M5 Paper, and some not?

    (e.g. the COREINK and M5GFX APIs support sprites - can I use those on M5 Paper?)


  • @hamnet hmmm! I've never seen Arduino headers and libraries referred to as APIs! (live and learn)
    Headers and libraries for a specific sensor or in this case a controller with built in screen are like a "driver" in Windows that takes care of background nitty gritty details.
    The APX192 is a complex power system manager found in the Core modules (and M5Stickc).
    The Paper does not have this hardware so the M5.Axp.PowerOff(); command cannot be used.
    The API for the Paper lists the APX function erroneously. You will see that the example that you included in your post, SetAlarmIRQ() is actually uses #include <M5Core2.h>, which is a Core!!!
    The SetAlarmIRQ() may work if you delete the APX. (also M5.Lcd.println will not work0
    Hope this helps, sorry to patronize you if you knew this!

  • Hi Terry @teastain you can't patronise me! I really know nothing - I'm new to all of this - M5, ESP32, etc. Thanks for taking the time to help.

    So to be clear: can I use any of the other APIs? (E.g. Core, Core2?)

    And in relation to this particular example, how can I turn the power off or put the device into deep sleep until the RTC wakes it up, given that Axp.PowerOff(); isn't available? (The PAPER API system/button/power docs reference shutdown taking a delay to wake up again - but that does a full restart.)

  • You really know nothing about programming M5Stack?
    I’m going to say that you should be starting with UIFlow and then moving on to core Micropython which is what UIFlow is built on.
    If you did that then I could help but ADD stops me from using arduino

  • Well I wrote loads of programs in C (and a bit of C++) 20 years ago; and I've fiddled with Arduino a tiny bit a few years ago; so I think I'm comfortable in principle with working at that level. But I don't have any experience with ESP32, let alone M5 - and finding it hard to get both detailed (accurate!) reference documentation, and also the basic orientation.

  • @hamnet There are some like the GFX that are not interchangeable. non e-ink devices have a refresh rate in milliseconds where as E-ink is counted in seconds because of the ay e-ink tech works. If you try using non e-ink graphics libs instead of the e-ink libs then you risk overdriving the displays and killing it.

    Have you watched all the YouTube videos on the M5Paper and M5Ink units?

  • @hamnet Great! If you are familiar with C++ and Arduino, stick to it!
    I'm not familiar with the Paper product but the display consumes no power when the image is static, and you can run it on a USB cube power supply.
    The other M5Stack products have an LCD display with constant current needed to power the backlight.
    As I am not familiar with PAPER, I guess I'm "deflecting" a little!
    M5Stack sometimes lacks in documentation and that's why this Community exists.
    Try this other Community post!

  • @teastain that post looks very relevant, I'll see if I can understand it! My use case is that I'm trying to create a unit that will run on battery power for as long as possible; fetching data over WiFi only once every few days; updating the display perhaps 4-5 times/hour. So I want it to consume as little as possible most of the time.

    @ajb2k3 thank you, I'll check out the videos (I normally avoid videos, I find it easier to learn from text). To clarify, I think you're implying that some of the other APIs are available to me on M5Paper, but some aren't - is that correct?

  • @hamnet Yes, correct.

  • @ajb2k3

    To clarify, I think you're implying that some of the other APIs are available to me on M5Paper, but some aren't - is that correct?

    Yes, correct.

    Is there any way to tell which ones can and which can't? Is it API by API, or is it more granular - certain functions documented under other APIs are available?

    For example, are the functions under available - lightSleep, deepSleep etc?

    Thanks again for all the help.