turgu1 / ESP-IDF-InkPlate

A porting effort to the ESP-IDF framework for the e-Radionica InkPlate software.
15 stars 9 forks source link

Added support for Inkplates that are missing second MCP #8

Closed gogi640 closed 2 years ago

gogi640 commented 2 years ago

New Inkplates are shipped without second MCP I/O expander because of chip shortage. If Inkplate without second MCP I/O expander is programmed using this library, it will hang out on function that is setting it's pins to LOW state, so in this commit is added part of code which stops it.

turgu1 commented 2 years ago

Hello Goran, thanks for the info and your suggestion to support the missing MCP.

There is another approach to support the missing device. It would be completely transparent to any user programs that don't need to access the second MCP. If you look at branch v0.9.5, in the src/drivers/rtc_pcf85063.cpp at the beginning of the RTC::setup() method, the following lines appear:

  wire.begin_transmission(rtc_address);
  present = wire.end_transmission() == ESP_OK;      

  if (!present) return false;

I think that a similar approach can be used to verify the presence of the second MCP (in fact, it would verify the presence of any MCP). An added method like bool RTC::is_present() would then allow the code to check the presence. No need to modify the user's code then.

Please comment, Cheers! Guy

turgu1 commented 2 years ago

Thinking again about this issue, my proposal is the one to implement as the EPUB-Inkplate application would only require an update to the current version. It would not require implementing specific releases for the missing MCP as the code will automatically detect its presence or not.

turgu1 commented 2 years ago

I will push a new branch (v0.9.6) with the automatic detection of the second MCP. Would it be possible for you to check if it works as all my devices (Inkplate-10 and 6PLUS) do have the second MCP?

turgu1 commented 2 years ago

Branch v0.9.6 is now available. Please comment.

turgu1 commented 2 years ago

As the MCP detection code is working. I'm closing the PR.