Graphic Display v1.0.0
Control any mochrome display, with any microcontroller, in any amount.
|
Driver definition for the Graphic Display library, this driver is the main reason why we can use any display with this library, you just need to create functions that are compatible with this structure. More...
Data Structures | |
struct | gd_driver_t |
Struct that creates a driver for the display, holding the handle and functions that are private of the display driver. This allows the library to be very flexible and can handles any display. More... | |
Driver definition for the Graphic Display library, this driver is the main reason why we can use any display with this library, you just need to create functions that are compatible with this structure.
Create a folder to place the source code of your driver, in this way, we can keep a clean and nice repository.
Suppose we create a driver for a fictional ss9090 device, we will create ss9090.h and ss9090.c files.
The handle structure is used to keep data of a display, with this approach, we can have many displays our project requires, and this displays can be the same or different.
The most common parameters are the:
Other parameters, that's are optional, but recommended, if a function to mutex lock and unlock (useful for RTOS environments that need threadsafe), and Delay Milliseconds routine, some times, delay is mandatory in initialization.
Remember, the driver must be not glued with any chipset, this library must be compatible with any microcontroller.
Here, we have the MANDATORY FUNCTIONS, must be implemented by you, following the fictional ss9090, we have this prototypes:
At this point, test your library, check if initialization works, if the pixels are written into correct position, response speed, and everything else.
After you test your driver, you can move on to the next steps.
Go to GraphicDisplay.h and include the new driver
Before the Public functions, you will see a piece of code with the Driver externs.
Here, you need to create the extern pointer to the driver, this will help developer to insert the driver on code. For SS9090, we write as follows the extern:
Go to GraphicDisplay.c, in the beginning, you will see the structs containing the drivers, now, creates the instance attributing the function calls to the struct, and the pointer. Here, we use pointers, because they are more fast to pass as a parameters. For our fictional SS9090 driver, we have something similar to this:
Your library is implemented, so, almost, all you need to do is test your implementation ans check if everything works as expected.
Any doubts, feel free to open issues into the repository.
Engineer: Pablo Jean Rozario.