Skip to content

Instantly share code, notes, and snippets.

@jadonk
Created March 8, 2019 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jadonk/066808475f3bc1ef7aeb34414d9fde14 to your computer and use it in GitHub Desktop.
Save jadonk/066808475f3bc1ef7aeb34414d9fde14 to your computer and use it in GitHub Desktop.
#!/bin/sh
echo 7 > /proc/sys/kernel/printk
dmesg -n 7
OVLY=/sys/kernel/config/device-tree/overlays/accel
mkdir -p $OVLY
cat $OVLY/status
dtc -W no-unit_address_vs_reg -@ -o $OVLY/dtbo <<EOF
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
accel@53 {
compatible = "adi,adxl345";
reg = <0x53>;
interrupt-parent = <&intc>;
interrupts = <69>; // timer3
};
};
};
fragment@1 {
target = <&timer3>;
__overlay__ {
status = "okay";
clock-frequency = <1>; // 1 Hz
};
};
};
EOF
cat $OVLY/status
modprobe adxl34x-i2c
dmesg | tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment