From 4b10177d92a66e653035da8c4c4022f6543d36cf Mon Sep 17 00:00:00 2001 From: w4ilun Date: Thu, 20 Apr 2023 09:54:41 -0400 Subject: [PATCH] for beeper --- sharp.c | 6 ++--- sharp.dts.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 sharp.dts.txt diff --git a/sharp.c b/sharp.c index 255ae94..8442310 100644 --- a/sharp.c +++ b/sharp.c @@ -27,9 +27,9 @@ char vcomByte = 0b01000000; char clearByte = 0b00100000; char paddingByte = 0b00000000; -char DISP = 24; -char SCS = 23; -char VCOM = 25; +char DISP = 22; +char SCS = 8; +char VCOM = 23; int lcdWidth = LCDWIDTH; int lcdHeight = 240; diff --git a/sharp.dts.txt b/sharp.dts.txt new file mode 100644 index 0000000..fd0142e --- /dev/null +++ b/sharp.dts.txt @@ -0,0 +1,61 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; + + fragment@0 { + target = <&spi0>; + __overlay__ { + status = "okay"; + + spidev@0{ + status = "disabled"; + }; + + spidev@1{ + status = "disabled"; + }; + }; + }; + + fragment@1 { + target = <&spi0_pins>; + __overlay__ { + brcm,pins = <0x0a 0x0b>; /* skipping bcm9 MISO */ + }; + }; + + fragment@2 { + target = <&gpio>; + __overlay__ { + sharp_pins: sharp_pins { + brcm,pins = <23 22>; + /* brcm,pins = <9 23>; */ /* <- older revision */ + brcm,function = <1 1>; /* out */ + }; + }; + }; + + fragment@3 { + target = <&spi0>; + __overlay__ { + /* needed to avoid dtc warning */ + #address-cells = <1>; + #size-cells = <0>; + + sharp: sharp@0{ + compatible = "sharp"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&sharp_pins>; + spi-cs-high = <1>; + spi-max-frequency = <2000000>; + buswidth = <8>; + debug = <0>; + + }; + + }; + }; +};