I am trying to write a library for doing interesting graphics (high-level interfaces for GFX primitives, such as defining 3D objects). I need to write code that will work with all the displays and touch screens. I have seen one such library, which requires that it be compiled for each device configured in the actual library source, instead of having a device-independent library that does the right thing for whatever display is connected.
Has anyone tried this? Is there a standard way to write such libraries such that the library source requires no modification for different displays/touchscreens/etc?
joe
Generic displalys and touch screens
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Generic displalys and touch screens
The GFX library itself is a good example of this. It is device independent down to the setPixel() level. At a minimum, you need to override the setPixel() function for your display hardware. All other functions ultimately resolve down to that by default as the least-common-denominator.
The limitation of that approach is that it ignores any more advanced hardware-specific capabilities that may be about to accomplish the same thing much more efficiently. On limited-horsepower, resource-constrained systems like many of the popular microcontroller boards, you need to make the most of what you have. So you will see that some display drivers override higher level GFX functions to achieve higher performance.
The limitation of that approach is that it ignores any more advanced hardware-specific capabilities that may be about to accomplish the same thing much more efficiently. On limited-horsepower, resource-constrained systems like many of the popular microcontroller boards, you need to make the most of what you have. So you will see that some display drivers override higher level GFX functions to achieve higher performance.
Please be positive and constructive with your questions and comments.