micpython ili9342c驱动程序
时间: 2023-08-08 17:12:41
浏览: 150
对于使用MicroPython的ILI9342C驱动程序,你可以使用以下[代码]([http]([http](https://geek.csdn.net/educolumn/68f28ca3131d47699e5902c5d3d74d51?spm=1055.2569.3001.10083)s://geek.csdn.net/educolumn/68f28ca3131d47699e5902c5d3d74d51?spm=1055.2569.3001.10083)s://geek.csdn.net/educolumn/1572ef9b473b4e00f6b2bf6d428b7c27?spm=1055.2569.3001.10083):
```python
import machine
import time
import gc
# ILI9342C commands
ILI9342_SOFTRESET = const(0x01)
ILI9342_SLEEP_OUT = const(0x11)
ILI9342_INVERT_OFF = const(0x20)
ILI9342_DISPLAY_ON = const(0x29)
ILI9342_COLUMN_ADDR = const(0x2A)
ILI9342_[page](https://geek.csdn.net/educolumn/1c66455c37fe0c4b32e4414c4c6aeead?spm=1055.2569.3001.10083)_ADDR = const(0x2B)
ILI9342_MEMORY_WRITE = const(0x2C)
class ILI9342C:
def __init__(self, spi, cs, dc):
self.spi = spi
self.cs = cs
self.dc = dc
self.cs.init(mode=machine.Pin.OUT, value=1)
self.dc.init(mode=machine.Pin.OUT, value=0)
self.width = 320
self.height = 240
self.[buffer](https://geek.csdn.net/educolumn/60b4840c0d25f5114c0cae30358a3db8?spm=1055.2569.3001.10083) = bytearray(self.width * self.height * 2)
self.reset()
```