Skip to content

Instantly share code, notes, and snippets.

@sneakin
Created September 11, 2018 06:53
Show Gist options
  • Save sneakin/2e0388e1373742152088fb12a2596af4 to your computer and use it in GitHub Desktop.
Save sneakin/2e0388e1373742152088fb12a2596af4 to your computer and use it in GitHub Desktop.
Overlay for Adafruit's OLED Bonnet https://www.adafruit.com/product/3531
//!/usr/bin/dtc -I dts -O dtb -o bonnet.dtbo bonnet.dts
// Overlay for Adafruit's OLED Bonnet https://www.adafruit.com/product/3531
// May need to add "fbcon=map:1" to /boot/cmdline.txt
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target-path = "/";
__overlay__ {
keypad: keypad {
compatible = "gpio-keys";
a {
label = "bonnet A";
linux,code = <28>; // return
gpios = <&gpio 5 0>;
};
b {
label = "bonnet B";
linux,code = <22>; // backspace
gpios = <&gpio 6 0>;
};
up {
label = "bonnet up";
linux,code = <103>;
gpios = <&gpio 17 0>;
};
down {
label = "bonnet down";
linux,code = <108>;
gpios = <&gpio 22 0>;
};
left {
label = "bonnet left";
linux,code = <105>;
gpios = <&gpio 27 0>;
};
right {
label = "bonnet right";
linux,code = <106>;
gpios = <&gpio 23 0>;
};
center {
label = "bonnet center";
linux,code = <29>; // control
gpios = <&gpio 4 0>;
};
};
};
};
fragment@1 {
target = <&i2c>;
__overlay__ {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
ssd1306: oled@3c {
compatible = "solomon,ssd1306fb-i2c";
reg = <0x3c>;
solomon,prechargep1 = <0x1>;
solomon,prechargep2 = <0xf>;
solomon,width = <128>;
solomon,height = <64>;
solomon,page-offset = <0>;
solomon,com-invdir;
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment