Customer:
Here is a summary of my ongoing porting effort for the Inkplate-6 device access software. This work is mandatory before I can port the EPub app to the device. All of this can be found on GitHub: GitHub - turgu1/EPub-InkPlate: An EPub Reader for the ESP32 based InkPlate e-Ink devices. · GitHub . The EPub app code has been put in another project: https://github.com/turgu1/EPub-Linux and is now using PlatformIO for compilation. It will be migrated piece by piece once the driver layer is ready.
1) Separation of concerns:
I’ve retrieved content from: Inkplate.* System.* Mcp.* defines.h and a small portion of Graphics.h to build two classes responsible for almost all hardware access: MCP and EInk. An ESP class gives support methods for the drivers in connection with ESP-IDF. A Wire class is being developed to give access to the I2C bus with an interface similar to the one supplied by the Arduino framework. I renamed System as InkPlate and it will have the role of a controller for the device.
Using inheritance as the current Arduino implementation causes an issue with separation of concerns. If I want only low-level access to the hardware without the graphical libraries, it is necessary to disconnect the hard binding between classes through inheritance. So I decided to cut the sub-class connection between the drivers and the rest of the library. I will do the same for the Graphics class, as it can also be handy to keep it separate from the GFX. A new class would then be required to bind the GFX with the other pieces through association instead of inheritance.
2) Object management:
The MCP and EInk classes have been constructed using the Singleton pattern: It is not possible to duplicate them in a piece of software, as they are managing part of the underneath hardware. The C++ compiler can then raise errors if a code design would create a situation by which the MCP and EInk instances would be duplicated. I’ve done a lot of #define integration inside the classes. This renders the classes more conventional in a C++ sense and helps readability of the code.
3) C++ naming conventions:
I have revisited all names (variables, constants, methods, class names) to apply a single convention:
- constants are all in UPPER_CASE
- class and type definitions are in CamelCase
- variables and methods are in underscore_name
I’ve removed the underscore preceding many variable names (e.g. ‘send’ instead of ‘_send’). Some method names have been changed to verbs. That is the case for display1b and display3b that are now named update_1b and update_3b.
4) Questions:
Is there a reason to keep separate both 1bit and 3bit buffers used by Graphics and GFX to prepare the drawings? It seems that as the device is in one mode or the other, a single buffer large enough to accommodate both modes would be OK. This will save 60K of ram. Another way to do this would be to let the upper application decide on its need and supply the appropriate buffer to the driver (the driver would not be managing 4 buffers but only the two required for the screen update process; new parameters will appear for the update methods to receive the buffer of data).
I’ve looked at your 1-hour video live demonstration on Youtube to grasp a sense of the library functionality. At some point, your colleague indicated the need of calling the clear method before displaying stuff. Is it always the case? If so, wouldn’t it be better to integrate this call in the update_xx methods?