Inky pHAT version


#1

Dear Pimoroni,

So there is a new library to support InkypHAT, but that new version does not support V1 InkypHAT… this trigger a few obvious questions:

  1. How do you recognise if you have a V1, V2 or other version of InkypHAT? Mine is from order #PI246664 from February 18, 2018. Of course the answer for my case would be great, but a more general answer with visual clue, or date of order, …

  2. Since there is code around that use the old library, is there a place where you explain the differences between old and new API and how to port a software from the old to the new.

Regards

David Glaude


#2

The long and short of it is that the old library was an ungodly horror from the deep, and I used the Inky wHAT as an excuse to re-imagine it with lots of the ugly ripped out, and a focus on just-communicating-with-the-board rather than embedding a whole bunch of Python PIL functionality directly into the library.

The approach for porting examples is basically to create your own PIL Image and ImageDraw objects and redirect any draw calls originally targeted at inkyphat across to those instead, before finally setting the finished image to inky and displaying it.

For example in Inky we create an img object and draw object to build up content upon:

Then draw to that:

And set the finished image for display:

Whereas in the old Inky pHAT library you could set an image:

And then draw over it:

The key advantage to Inky’s approach is that it’s not hiding the implementation details of PIL, and thus forces the user to learn portable image manipulation skills. This also means you don’t have to use PIL at all if you want a lighter-weight project or to use an alternate image library.

Telling the difference between Inky pHAT V1 and V2 is tricky. We never explicitly marked the version on the silk since Inky V1 was a relatively short and doomed production run. Basically you have a V2 if:

  • It’s Yellow or Black, there was never a V1 in these colours
  • Or the back looks like the image below, since the new display on V2 necessitated different supporting components:

The older V1 Inky pHAT lacks an indictor (the big square thing in that photo) and has a different layout of the passive components that should be obvious when you compare it to this image.


#3

Thanks, I do have a V2.

(however not all of those surface mounted component are present on mine, but the big square thing is there)

Now is time to investigate PIL…