changeset 49:7755717740dc

Add TFT shield
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Fri, 07 Jul 2017 18:59:11 +0200
parents d2b66c111e26
children 6482082f9187
files shields.rst
diffstat 1 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/shields.rst	Fri Nov 25 17:01:02 2016 +0100
+++ b/shields.rst	Fri Jul 07 18:59:11 2017 +0200
@@ -161,8 +161,8 @@
 board to work. You can simply plug it in and use it.
 
 
-Servo
-=====
+Servo (Custom)
+==============
 
 There is an experimental 18-channel servo shield. It uses the I²C protocol on
 pins ``gpio4`` and ``gpio5`` and is compatible with other I²C shields.
@@ -173,9 +173,29 @@
 
 You can set the servo positions using the following code::
 
-    from d1servo18ch import Servos
+    from servo import Servos
     from machine import I2C, Pin
     i2c = I2C(Pin(5), Pin(4))
     servos = Servos(i2c)
-    servos[0] = 1500
+    servos.position(0, degrees=45)
+
+
+TFT Screen (Custom)
+===================
+
+There is an experimental breakout board for the ST7735 TFT screen. It uses the
+SPI interface on pins ``gpio12``, ``gpio13``, ``gpio14``, and ``gpio15``.
+
+You can use it with the following example code::
 
+    from machine import Pin, SPI
+    import st7735
+    from rgb import DummyPin
+
+    display = st7735.ST7735(SPI(1), dc=Pin(12), cs=DummyPin(), rst=Pin(15))
+    display.fill(0x7521)
+    display.pixel(64, 64, 0)
+
+If you have a display with a red tab, you need to use a different initialization::
+
+    display = st7735.ST7735R(SPI(1, baudrate=40000000), dc=Pin(12), cs=DommyPin(), rst=Pin(15))