use RES pin for examples

This commit is contained in:
devsaurus 2015-03-17 21:03:15 +01:00
parent 09b650be41
commit b34a8b46fe
4 changed files with 19 additions and 15 deletions

View File

@ -398,9 +398,10 @@ disp = u8g.ssd1306_128x64_i2c(sla)
``` ```
SSD1306 via SPI: SSD1306 via SPI:
```lua ```lua
cs = 8 -- GPIO15, pull-down 10k to GND cs = 8 -- GPIO15, pull-down 10k to GND
dc = 4 -- GPIO2 dc = 4 -- GPIO2
disp = u8g.ssd1306_128x64_spi(cs, dc) res = 0 -- GPIO16, RES is optional YMMV
disp = u8g.ssd1306_128x64_spi(cs, dc, res)
``` ```
This object provides all of u8glib's methods to control the display. This object provides all of u8glib's methods to control the display.

View File

@ -14,12 +14,13 @@ function init_spi_display()
-- Hardware SPI CLK = GPIO14 -- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13 -- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used) -- Hardware SPI MISO = GPIO12 (not used)
-- CS and D/C can be assigned freely to available GPIOs -- CS, D/C, and RES can be assigned freely to available GPIOs
cs = 8 -- GPIO15, pull-down 10k to GND cs = 8 -- GPIO15, pull-down 10k to GND
dc = 4 -- GPIO2 dc = 4 -- GPIO2
res = 0 -- GPIO16
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0)
disp = u8g.ssd1306_128x64_spi(cs, dc) disp = u8g.ssd1306_128x64_spi(cs, dc, res)
end end

View File

@ -14,12 +14,13 @@ function init_spi_display()
-- Hardware SPI CLK = GPIO14 -- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13 -- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used) -- Hardware SPI MISO = GPIO12 (not used)
-- CS and D/C can be assigned freely to available GPIOs -- CS, D/C, and RES can be assigned freely to available GPIOs
cs = 8 -- GPIO15, pull-down 10k to GND cs = 8 -- GPIO15, pull-down 10k to GND
dc = 4 -- GPIO2 dc = 4 -- GPIO2
res = 0 -- GPIO16
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0)
disp = u8g.ssd1306_128x64_spi(cs, dc) disp = u8g.ssd1306_128x64_spi(cs, dc, res)
end end

View File

@ -14,12 +14,13 @@ function init_spi_display()
-- Hardware SPI CLK = GPIO14 -- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13 -- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used) -- Hardware SPI MISO = GPIO12 (not used)
-- CS and D/C can be assigned freely to available GPIOs -- CS, D/C, and RES can be assigned freely to available GPIOs
cs = 8 -- GPIO15, pull-down 10k to GND cs = 8 -- GPIO15, pull-down 10k to GND
dc = 4 -- GPIO2 dc = 4 -- GPIO2
res = 0 -- GPIO16
spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0) spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, spi.DATABITS_8, 0)
disp = u8g.ssd1306_128x64_spi(cs, dc) disp = u8g.ssd1306_128x64_spi(cs, dc, res)
end end