Skip to content

Commit 0f004bf

Browse files
zgodad-a-v
authored andcommitted
Cleaned up Nokia 5110 LCD sample code (#1091)
1 parent 8230f2c commit 0f004bf

File tree

1 file changed

+22
-32
lines changed

1 file changed

+22
-32
lines changed

samples/ScreenLCD_5110/app/application.cpp

+22-32
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,33 @@
22
#include <SmingCore/SmingCore.h>
33
#include <Libraries/Adafruit_PCD8544/Adafruit_PCD8544.h>
44

5-
// Software SPI (slower updates, more flexible pin options):
6-
// pin 7 - Serial clock out (SCLK)
7-
// pin 6 - Serial data out (DIN)
8-
// pin 5 - Data/Command select (D/C)
9-
// pin 4 - LCD chip select (CS)
10-
// pin 3 - LCD reset (RST)
11-
Adafruit_PCD8544 display = Adafruit_PCD8544(14, 13, 12, 5, 4);
5+
// GPIO13/D7 - Serial clock out (SCLK)
6+
// GPIO12/D6 - Serial data out (DIN)
7+
// GPIO14/D5 - Data/Command select (D/C)
8+
// GPIO5/D1 - LCD chip select (CS)
9+
// GPIO4/D2 - LCD reset (RST)
10+
Adafruit_PCD8544 display = Adafruit_PCD8544(13, 12, 14, 5, 4);
11+
12+
1213
void displayTest()
1314
{
1415
display.begin();
15-
// init done
16-
17-
// you can change the contrast around to adapt the display
18-
// for the best viewing!
19-
display.setContrast(10);
20-
21-
display.display(); // show splashscreen
22-
delay(200);
23-
display.clearDisplay(); // clears the screen and buffer
24-
25-
display.setRotation(4); // rotate 90 degrees counter clockwise, can also use values of 2 and 3 to go further.
26-
display.setTextSize(1);
27-
display.setTextColor(BLACK);
28-
display.setCursor(0,0);
29-
display.println("Sming");
30-
display.setTextSize(2);
31-
display.println("Example!");
32-
display.display();
16+
display.setContrast(10);
17+
display.display(); // show splashscreen
18+
delay(2000);
19+
display.clearDisplay(); // no changes will be visible until display() is called
20+
display.setRotation(4); // rotate 90 degrees counter clockwise, can also use values of 2 and 3 to go further.
21+
display.setTextSize(1);
22+
display.setTextColor(BLACK);
23+
display.setCursor(0, 0);
24+
display.println("Sming");
25+
display.setTextSize(2);
26+
display.println("Example");
27+
display.display();
3328
}
29+
3430
void init()
3531
{
36-
Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
37-
Serial.systemDebugOutput(true); // Enable debug output to serial
38-
39-
WifiStation.enable(false);
40-
WifiAccessPoint.enable(true);
41-
32+
Serial.begin(SERIAL_BAUD_RATE);
4233
displayTest();
4334
}
44-

0 commit comments

Comments
 (0)