first tests
This commit is contained in:
38
HeadUnit.ino
Normal file
38
HeadUnit.ino
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <U8g2lib.h>
|
||||||
|
|
||||||
|
// Use FULL buffer variant so clearBuffer()/sendBuffer() work
|
||||||
|
U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI display(U8G2_R0, 5, 16, 17);
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
uint8_t contrast = 0;
|
||||||
|
|
||||||
|
void initScreen() {
|
||||||
|
display.clearBuffer();
|
||||||
|
display.setFont(u8g2_font_9x18_tf);
|
||||||
|
int width = display.getStrWidth("HeadUnit");
|
||||||
|
int x = 127 - (width/2);
|
||||||
|
display.drawStr(x, 30, "HeadUnit");
|
||||||
|
display.setFont(u8g2_font_7x13_tf);
|
||||||
|
width = display.getStrWidth("Version 0.1");
|
||||||
|
x = 127 - (width/2);
|
||||||
|
display.drawStr(x, 50, "Version 0.1");
|
||||||
|
display.sendBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
display.begin();
|
||||||
|
display.setContrast(255);
|
||||||
|
display.setBusClock((20*1000000));
|
||||||
|
|
||||||
|
initScreen();
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
|
display.clearDisplay();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user