Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PicoGraphics direct pens #613

Closed
wants to merge 21 commits into from

Conversation

AndrewCapon
Copy link
Contributor

@AndrewCapon AndrewCapon commented Dec 29, 2022

This also contains:

#593

#596

The idea here is to enable PicoGraphics Pens to work without frame buffers, so directly to the display.

Display drivers need to implement the templated pure virtual interface IDirectDisplayDriver is they want to support this.

template<typename T> class IDirectDisplayDriver {
    public:
      virtual void write_pixel(const Point &p, T colour) = 0;
      virtual void write_pixel_span(const Point &p, uint l, T colour) = 0;
      virtual void write_pixel_rect(const Rect &r, T colour) = 0;
  };

write_pixel() should write a single pixel to the display.
write_pixel_span() should write a scanline/span of pixels
write_pixel_rect() should write a rectangle of pixels. This is currently not used.

A single direct pen has been implemented PicoGraphics_PenRGB565_direct

I have only updated the ili9341 driver to implement the interface, if people think this direct pen idea is a good idea I will update the ST7789 driver as well.

An example is provided ili9341_direct_demo has been added to show everything working.

Draws the frame of a rectangle.
Pico Display 2 examples ported.
Major change, the registers used before were incorrect, the x and y were swapped, the code I cribbed them from was wrong!
Also implemented pressure (Z) as some screens give wonky results with light pressure. Pressure rejection to touch is on line 73 of xpt2046.cpp, currently set at 50% of max pressure.
We also now have a pressure value for points (now TouchPoints), from 0-100 where 100 is max pressure.
Add TouchPoint struct.
Add calibration for Z.
@ZodiusInfuser ZodiusInfuser added [- pico graphics library -] c++ This issue or request relates to C++ code needs discussion This issue or request is in need of further discussion labels Jan 20, 2023
@Gadgetoid
Copy link
Member

The direct pen concept is getting some field-testing for Inky Frame, so we'll see how that pans out. There's some discussion about whether it should be replaced with a generic hardfault handler to map the PSRAM but I'm not sure how well that would work in MicroPython.

@Gadgetoid
Copy link
Member

With PicoVision we now have a project that uses out-of-tree, non-direct display drivers - https://github.com/pimoroni/picovision

I think this is how ili9341 and xpt2046 should be handled. Our MicroPython builds are bloating out of control, and this repository is getting a little too monolithic to be navigable, so I'm slowly trying to break it apart into logical units and only put stuff here that's used by and shared across our products.

It looks like IDirectDisplayDriver and similar concepts are here to stay, though, thank you!

@Gadgetoid Gadgetoid closed this Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[- pico graphics library -] c++ This issue or request relates to C++ code needs discussion This issue or request is in need of further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants