-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for M5Stack M5Paper #8293
Conversation
Not sure what's going on with the |
|
@dhalbert I was following the automated pre-commit patch for that update - anything I can do to fix it? Also, could you take a look at the pins to see if there's any further addition needed? The M5Paper is quite limited in exposed pins, and they're all part of the typical M5Stack A/B/C ports, so I'm not sure if there's any point in adding the analog/digital/touch pin definitions. |
@fonix232 Don't worry about the pygamer failure. We will fix that later. We can merge without it.
These are the |
@dhalbert PortA/PortB/PortC pins are available externally through 4-pin Molex connectors (5V, GND, plus the two pins of the port as per
Edit: I shouldn't be commenting before my morning coffee. So just to clarify: There are in total SIX pins available for the user to access: pins 18 and 19 (used for UART by default), pins 26 and 33 (used as GPIO), and pins 25 and 32 (used as I2C). These can be reconfigured for any supported function of the ESP32. |
Oh also @dhalbert one more question - since this device comes with some integrated features (display, touchscreen, BMS, SHT3x sensor set, RTC controller, etc.), including some that require mandatory pre-init (e.g. pulling up pin 2 on boot to enable the main power rails)... Is there a way in CircuitPython to make an abstract instance of these features available? I'm guessing that I could make the power-related init sequences part of |
For the onboard I2C devices like SHT, touch, RTC, is there a separate on-board I2C bus, or is it shared with external pins? You can make multiple I2C buses that appear in But we don't provide Some folks with highly integrated boards or educational boards add board-specific libraries, sometimes frozen, sometimes not. You could do that if you want. CPX is our only example, and we only did that to get around the limited RAM of CPX. CPB does not freeze anything. |
@dhalbert the internal I2C bus is on pins I've tried to be descriptive with the naming, as you can see GPIO25 is assigned to the For internals, I just relied on the standard naming of Pardon my ignorance but what are CPX and CPB? I've also looked into the QTPy board, but aside from a generic I2C, SPI and UART definition, I'm not seeing where the pin values are assigned:
or are |
The circuitpython/ports/espressif/boards/adafruit_qtpy_esp32s2/pins.c Lines 58 to 61 in 506dca7
The two buses are created here, with their pins specified. Note the (2) :circuitpython/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h Lines 35 to 37 in 506dca7
The extra singleton for board.STEMMA_I2C is defined at the top of pins.c . The 1 is a subscript for the second entry from the mpconfigboard.h definition above. The two definitions are [0] and [1] .
|
CPX and CPB are Circuit Playground Express (SAMD21) and Circuit Playground Bluefruit (nRF52840) -- sorry! |
Brilliant, thanks @dhalbert. I'll be pushing the changes to reflect these details soon. Also thanks for pointing me at the CPX/CPB boards, the way frozen libraries are handled is really straightforward now that I see an example. I think the best way forward would be to add the necessary drivers to a separate repo, and add that as a submodule, then finally add them as frozen modules to this board. I understand that this wouldn't necessarily be the preferred way of doing things, but since this is a regular ESP32 board, a similar issue to the CPX's memory problem pops up - the harder management due to having no true USB interface. Therefore I think bundling the drivers frozen is the best option we have for full support. Is there a project template I could follow for the frozen libraries? Also, how about incorporating native C/C++ code in these modules? Most of the M5EPD code, even the ported bits for other platforms, is in C++, and with my level of knowledge I don't feel 100% safe rewriting those drivers (or maintaining them!). Fortunately most of the protocols are pretty standard and by the book. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me. Do you have more changes you want to add before merging?
@tannewt shall I remove the commented out init sequence for the EPD? The IT8951E driver is quite complex (and the M5Paper has some weirdness about bringing up the SPI bus, apparently at init it needs to be low speed, around 1MHz, then later ramped up to 10-20MHz), and I'm not sure I'll have the time to port it. Also, since apparently the REPL is pushed to the main display (based on the Waveshare ESP32-S2-Pico-LCD I got, which does so), I'm not sure if it's wise to have the display assigned to the board itself (EPD can't really keep up with the speed of the REPL). |
Totally fine to leave it out until you have time to add it. Folks can always do it from user Python code too. |
In that case, if you don't mind, let's leave the commented out code as-is, it might be a good future pointer for anyone who wants to implement it. Which means it's ready to merge 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #8290
Current status:
Things left to do: