start dt
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,4 +14,6 @@ driver/*.mod.c
|
|||||||
driver/*.mod.o
|
driver/*.mod.o
|
||||||
driver/*.o
|
driver/*.o
|
||||||
driver/modules.order
|
driver/modules.order
|
||||||
|
dtoverlay/*.dtbo
|
||||||
|
|
||||||
|
|
||||||
|
26
dtoverlay/Makefile
Normal file
26
dtoverlay/Makefile
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Source and target file names
|
||||||
|
DTS = counter.dts
|
||||||
|
DTBO = counter.dtbo
|
||||||
|
|
||||||
|
# Installation paths
|
||||||
|
OVERLAY_DIR = /boot/overlays
|
||||||
|
CONFIG_TXT = /boot/firmware/config.txt
|
||||||
|
OVERLAY_NAME = counter
|
||||||
|
|
||||||
|
all: $(DTBO)
|
||||||
|
|
||||||
|
$(DTBO): $(DTS)
|
||||||
|
dtc -@ -I dts -O dtb -o $@ $<
|
||||||
|
|
||||||
|
install: $(DTBO)
|
||||||
|
sudo cp $(DTBO) $(OVERLAY_DIR)/
|
||||||
|
@if ! grep -q "^dtoverlay=$(OVERLAY_NAME)$$" $(CONFIG_TXT); then \
|
||||||
|
echo "dtoverlay=$(OVERLAY_NAME)" | sudo tee -a $(CONFIG_TXT); \
|
||||||
|
else \
|
||||||
|
echo "Overlay already present in config.txt."; \
|
||||||
|
fi
|
||||||
|
@echo "Installation complete. Reboot your Raspberry Pi to activate the overlay."
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.dtbo
|
||||||
|
|
24
dtoverlay/counter.dts
Normal file
24
dtoverlay/counter.dts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/dts-v1/;
|
||||||
|
/plugin/;
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "brcm,bcm2835";
|
||||||
|
|
||||||
|
fragment@0 {
|
||||||
|
target = <&gpio>;
|
||||||
|
__overlay__ {
|
||||||
|
gpio_led_blue: gpio_led_blue {
|
||||||
|
brcm,pins = <26>;
|
||||||
|
brcm,function = <1>; // output
|
||||||
|
brcm,pull = <0>; // no pull
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio_led_red: gpio_led_red {
|
||||||
|
brcm,pins = <21>;
|
||||||
|
brcm,function = <1>; // output
|
||||||
|
brcm,pull = <0>; // no pull
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
Reference in New Issue
Block a user