Browse Source

display: adafruit splash screen, invert every second

Fabian Peter Hammerle 3 years ago
commit
9abcbcb52e
12 changed files with 145 additions and 0 deletions
  1. 5 0
      .gitignore
  2. 15 0
      .gitmodules
  3. 10 0
      Makefile
  4. 32 0
      arduino-sketch.ino
  5. 1 0
      libraries/Adafruit_BusIO
  6. 1 0
      libraries/Adafruit_GFX
  7. 1 0
      libraries/Adafruit_SSD1306
  8. 1 0
      libraries/arduino-core
  9. 4 0
      pre-build-hook.sh
  10. 71 0
      schema.sch
  11. 3 0
      sym-lib-table
  12. 1 0
      symbols

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+/build-*/
+/schema-cache.lib
+/schema.pro
+/schema.sch-bak
+/version.h

+ 15 - 0
.gitmodules

@@ -0,0 +1,15 @@
+[submodule "libraries/Adafruit_SSD1306"]
+	path = libraries/Adafruit_SSD1306
+	url = https://github.com/adafruit/Adafruit_SSD1306
+[submodule "libraries/Adafruit_GFX"]
+	path = libraries/Adafruit_GFX
+	url = https://github.com/adafruit/Adafruit-GFX-Library
+[submodule "libraries/Adafruit_BusIO"]
+	path = libraries/Adafruit_BusIO
+	url = https://github.com/adafruit/Adafruit_BusIO
+[submodule "libraries/arduino-core"]
+	path = libraries/arduino-core
+	url = https://github.com/arduino/ArduinoCore-avr
+[submodule "symbols"]
+	path = symbols
+	url = git@git.hammerle.me:fphammerle/kicad-symbols.git

+ 10 - 0
Makefile

@@ -0,0 +1,10 @@
+# arduino-core=2:1.0.5+dfsg2-4.1 does not provide SPISettings
+ARDUINO_CORE_PATH = ./libraries/arduino-core/cores/arduino
+ARDUINO_LIB_PATH = ./libraries/arduino-core/libraries
+
+USER_LIB_PATH = ./libraries
+ARDUINO_LIBS = SPI Wire Adafruit_BusIO Adafruit_GFX Adafruit_SSD1306
+
+BOARD_TAG = uno
+
+include /usr/share/arduino/Arduino.mk

+ 32 - 0
arduino-sketch.ino

@@ -0,0 +1,32 @@
+#include <Adafruit_SSD1306.h>
+
+#include "version.h"
+
+const uint8_t DISPLAY_WIDTH = 128;
+const uint8_t DISPLAY_HEIGHT = 64;
+// https://startingelectronics.org/tutorials/arduino/modules/OLED-128x64-I2C-display/
+const uint8_t DISPLAY_I2C_ADDRESS = 0x3C;
+
+Adafruit_SSD1306 display(DISPLAY_WIDTH, DISPLAY_HEIGHT);
+
+void setup() {
+    // $ stty -F /dev/ttyUSB0 | grep speed
+    Serial.begin(115200);
+    Serial.println(PROJECT_REPO_URL);
+    Serial.println(PROJECT_VERSION);
+    if (!display.begin(SSD1306_SWITCHCAPVCC, DISPLAY_I2C_ADDRESS)) {
+        Serial.println("failed to init display");
+        while (true)
+            ;
+    }
+    display.display();
+}
+
+void loop() {
+    Serial.println("invertDisplay(true)");
+    delay(1000); // ms
+    display.invertDisplay(true);
+    Serial.println("invertDisplay(false)");
+    delay(1000); // ms
+    display.invertDisplay(false);
+}

+ 1 - 0
libraries/Adafruit_BusIO

@@ -0,0 +1 @@
+Subproject commit bb1ad733addf0b2925806371316ae92d2d026fa2

+ 1 - 0
libraries/Adafruit_GFX

@@ -0,0 +1 @@
+Subproject commit b53849e234dd5b7f837c38e64a740eabd6eb18ae

+ 1 - 0
libraries/Adafruit_SSD1306

@@ -0,0 +1 @@
+Subproject commit 56a1c9462a571cc74aacd819d75ac2d29fc09ade

+ 1 - 0
libraries/arduino-core

@@ -0,0 +1 @@
+Subproject commit 3055c1efa3c6980c864f661e6c8cc5d5ac773af4

+ 4 - 0
pre-build-hook.sh

@@ -0,0 +1,4 @@
+#!/bin/sh
+set -ex
+echo "#define PROJECT_REPO_URL \"$(git config --get remote.origin.url)\"" > version.h
+echo "#define PROJECT_VERSION \"$(git describe --dirty --long --always)\"" >> version.h

+ 71 - 0
schema.sch

@@ -0,0 +1,71 @@
+EESchema Schematic File Version 4
+EELAYER 30 0
+EELAYER END
+$Descr A4 11693 8268
+encoding utf-8
+Sheet 1 1
+Title ""
+Date ""
+Rev ""
+Comp ""
+Comment1 ""
+Comment2 ""
+Comment3 ""
+Comment4 ""
+$EndDescr
+$Comp
+L MCU_Module:Arduino_UNO_R3 A?
+U 1 1 5FF8619A
+P 7150 3150
+F 0 "A?" H 7150 4331 50  0001 C CNN
+F 1 "Arduino_UNO_R3" H 7150 4240 50  0000 C CNN
+F 2 "Module:Arduino_UNO_R3" H 7150 3150 50  0001 C CIN
+F 3 "https://www.arduino.cc/en/Main/arduinoBoardUno" H 7150 3150 50  0001 C CNN
+	1    7150 3150
+	1    0    0    -1  
+$EndComp
+NoConn ~ 4100 4850
+$Comp
+L custom-display:SSD1306_I2C_128x64PX_0.96IN_OLED_DISPLAY DS?
+U 1 1 5FF89C8D
+P 8700 3700
+F 0 "DS?" H 8700 3700 50  0001 C CNN
+F 1 "SSD1306_I2C_128x64PX_0.96IN_OLED_DISPLAY" H 9128 4083 39  0000 L CNN
+F 2 "" H 8700 3700 50  0001 C CNN
+F 3 "" H 8700 3700 50  0001 C CNN
+	1    8700 3700
+	1    0    0    -1  
+$EndComp
+Wire Wire Line
+	7350 2150 7350 2100
+Wire Wire Line
+	7350 2100 8650 2100
+Wire Wire Line
+	8650 2100 8650 3000
+Wire Wire Line
+	7250 4250 7250 4300
+Wire Wire Line
+	7250 4300 8150 4300
+Wire Wire Line
+	8150 4300 8150 2950
+Wire Wire Line
+	8150 2950 8550 2950
+Wire Wire Line
+	8550 2950 8550 3000
+Wire Wire Line
+	7650 3550 7850 3550
+Wire Wire Line
+	7850 3550 7850 2750
+Wire Wire Line
+	7850 2750 8850 2750
+Wire Wire Line
+	8850 2750 8850 3000
+Wire Wire Line
+	7650 3650 8000 3650
+Wire Wire Line
+	8000 3650 8000 2850
+Wire Wire Line
+	8000 2850 8750 2850
+Wire Wire Line
+	8750 2850 8750 3000
+$EndSCHEMATC

+ 3 - 0
sym-lib-table

@@ -0,0 +1,3 @@
+(sym_lib_table
+  (lib (name custom-display)(type Legacy)(uri ${KIPRJMOD}/symbols/display.lib)(options "")(descr ""))
+)

+ 1 - 0
symbols

@@ -0,0 +1 @@
+Subproject commit b1c00f8c030e39b49d0991894f6f2e9e5050dd2f