Added Multiple SPI Display FAQ

This commit is contained in:
Neil Panchal 2017-10-15 14:56:27 -07:00 committed by GitHub
parent ad1222c8bf
commit 21bdb98bd8
1 changed files with 26 additions and 0 deletions

View File

@ -193,3 +193,29 @@ A: A Windows executable is available here:
https://github.com/olikraus/u8g2/tree/master/tools/font/bdfconv
Use the Makefile in this directory to create a Linux binary.
Q: How can I use multiple SPI Displays?
A: For each additional display, a CS (Chip select) and a RST (Reset) line is required.
```C++
// Setup display1 and display2
U8G2_SSD1306_128X64_NONAME_F_4W_SW_SPI display1(U8G2_R0, /*CLK*/ 18, /*MOSI*/ 23, /*CS*/ 16,
/*DC*/ 17, /*RS*/ 4);
U8G2_SSD1306_128X64_NONAME_F_4W_SW_SPI display2(U8G2_R0, /*CLK*/ 18, /*MOSI*/ 23, /*CS*/ 15,
/*DC*/ 17, /*RS*/ 4);
```
Ensure that the buffer is sent after printing with each display as follows.
```C++
display1.begin();
display2.begin();
display1.setCursor(64, 32);
display1.print("DISPLAY 1");
display1.sendBuffer();
display2.setCursor(64, 32);
display2.print("DISPLAY 2");
display2.sendBuffer();
```