Hi,
My first post I've been using a Bit:2:Pi board from 4tronix.co.uk to drive an RPi Hat from a micro:bit. So far I've only tried an I2C device but I have that working OK. I'm using the "mu" editor on an PI3 to develop my code.
Now I'd like to move on to driving an Adafruit 3.5" TFT display. This uses SPI and I've been looking at the driver code in the RPI kernel sources and the HX8357 datasheet. The problem I see is that it is hard-wired to use a 4 wire interface with a "Control/Data" line that needs to be set low for the first bit of a command byte.
I'm and experienced C programmer so I think I should be able to tackle this, but I'm as yet unfamiliar with the MicroPython code base so I'm not sure where to start looking to add the required functionality so a few pointers to appropriate bits of the code would be helpful.
Thanks in advance
Peter Onion
Driving an SPI device that needs a Control/Data signal.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Driving an SPI device that needs a Control/Data signal.
You need to look at the Pin class in the machine module http://docs.micropython.org/en/latest/e ... e.Pin.html.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Driving an SPI device that needs a Control/Data signal.
The machine import doesn't seem to be available on the version of MicroPython included with Mu 0.9.13
PeterO
PeterO
Re: Driving an SPI device that needs a Control/Data signal.
You might want to take a look at how it's handled in the Adafruit's display libraries at https://github.com/adafruit/micropython ... gb-display
Re: Driving an SPI device that needs a Control/Data signal.
[quote="deshipu"]You might want to take a look at how it's handled in the Adafruit's display libraries at https://github.com/adafruit/micropython ... gb-display[/quote]
Thanks, that's very helpful ! I had worked out some of the stuff I need already, and even though they don't include exactly the device I have it will be a good starting point
PeterO
Thanks, that's very helpful ! I had worked out some of the stuff I need already, and even though they don't include exactly the device I have it will be a good starting point
PeterO
Re: Driving an SPI device that needs a Control/Data signal.
If you get it working with that library, a pull request would be great!