Additional framebuffer #16571
-
I am using a TFT driver designed by Peter Hinch and the class inherits the framebuffer class. This works well with no issues but I was wondering how difficult it would be to add a second framebuffer in the same class. Here is the relevant part of the code I already have
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This is a classic python has-a versus is-a situation. Making something a subclass is cute, but often limiting, in exactly the way you see. You might want to make your LCD class own framebuffers, rather than be a framebuffer. Then, you have complete freedom to control a list of framebuffers, as needed. You can pass through the calls in the framebuf.FrameBuffer class that you actually need, but select which framebuffer in your list receives the calls. |
Beta Was this translation helpful? Give feedback.
This is a classic python has-a versus is-a situation. Making something a subclass is cute, but often limiting, in exactly the way you see. You might want to make your LCD class own framebuffers, rather than be a framebuffer. Then, you have complete freedom to control a list of framebuffers, as needed. You can pass through the calls in the framebuf.FrameBuffer class that you actually need, but select which framebuffer in your list receives the calls.