Skip to content
This repository has been archived by the owner on Nov 1, 2019. It is now read-only.

Waveshare compatibility? #17

Closed
fiveseven808 opened this issue Jul 12, 2018 · 4 comments
Closed

Waveshare compatibility? #17

fiveseven808 opened this issue Jul 12, 2018 · 4 comments

Comments

@fiveseven808
Copy link

Looks like the spi instruction set is similar/same? (I didn't look too closely), but the inky-phat library is wayyyy better.

I tried to buy a genuine inky phat but adafruit was out, and I live in the US so it was just easier to buy the chinese waveshare einkphat vs waiting for adafruit to get back in stock, or buy direct.

I went into the library and changed the pinouts, but when I try and run anything I get the following:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    import inkyphat
  File "/usr/local/lib/python2.7/dist-packages/inkyphat-1.0.0-py2.7.egg/inkyphat/__init__.py", line 24, in <module>
    _panel = inky212x104.Inky212x104(resolution=(HEIGHT, WIDTH), h_flip=False, v_flip=True)
  File "/usr/local/lib/python2.7/dist-packages/inkyphat-1.0.0-py2.7.egg/inkyphat/inky212x104.py", line 111, in __init__
    self._spi.open(0, self.cs_pin)
IOError: [Errno 2] No such file or directory

I figure it's because I changed the cs_pin from 0 (what is 0???) to 8, since that's what the waveshare one uses.

According to the documentation (pimoroni pinout), it appears that the inky-phat uses the the same cs_pin though... so I change it back to 0, and I get the following output after running "python test.py red"

Traceback (most recent call last):
  File "test.py", line 15, in <module>
    inkyphat.set_colour(colour)
  File "/usr/local/lib/python2.7/dist-packages/inkyphat-1.0.0-py2.7.egg/inkyphat/__init__.py", line 40, in set_colour
    return _panel.set_colour(colour)
  File "/usr/local/lib/python2.7/dist-packages/inkyphat-1.0.0-py2.7.egg/inkyphat/inky212x104.py", line 118, in set_colour
    raise ValueError("V1 is only available in Red")
ValueError: V1 is only available in Red

I forgot what I did but at some point (before I reset my cloned repo) I got the programs to execute, however I wouldn't see any change on my waveshare display. It was strange, that it looked like everything was executing properly, except I would see no change. I can't figure out how I got it to that point though...

Anyway, If this is wholly unsupported you can close this issue, otherwise I feel like it might be a worthy endeavor for people stuck in my situation. At least, a fork might be doable if it's impolite to make this library compatible with a competing product.

@fiveseven808
Copy link
Author

Ahh... the more I look into it, the init sequences are different... This is definitely a different use case... I will work to see if I can't get this library to work with this...

@Gadgetoid
Copy link
Member

It's not something we'll ever officially support, but I don't mind offering guidance. You're of course welcome to fork this repo and produce a version for the Waveshare boards if you want!

The CS pins are mapped to 0 and 1 on the SPI device nodes:

  • BCM 8 corresponds to chip-select 0 or /dev/spidev0.0
  • BCM 7 corresponds to chip-select 1 or /dev/spidev0.1

And yes there's a lot of kerfuffle in the init routines for the Inky pHAT- it does some detection of old/new board versions (we switched to a different panel type) and that governs what colours are available.

@llakssz
Copy link

llakssz commented Aug 28, 2018

I agree Pimoroni wouldn't really want to help with this because they want you to buy their screens.
Months ago I bought a waveshare screen and then found this page - https://boeeerb.co.uk/creating-a-monzo-pot-epaper-tracker/
So, find this file - inky212x104.py
And change

RESET_PIN = 27
BUSY_PIN = 17
DC_PIN = 22

to

RESET_PIN = 17
BUSY_PIN = 24
DC_PIN = 25

It worked for me with my red screen.

I'm not sure about the latest inky-phat update (that adds yellows support etc), I did this before that update.
And I'm not sure if the yellow waveshare screens work fine with the old code, after making the adjustments above.

@Gadgetoid
Copy link
Member

If someone can figure out how to make the new Inky library flexible enough to be easily compatible with Waveshare boards, I'd gladly accept a PR. See- https://github.com/pimoroni/inky

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants