diff --git a/README.md b/README.md index 27da8f9..2327ac8 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,17 @@ A C and Python library for use with the Widgetlords [WL-MIO](https://wlmio.com/) ## Dependencies +- Python 3.9 - libcanard (MIT) - libgpiod (LGPL-2.1) ## Package for Raspberry Pi +Download a (Release)[https://github.com/widgetlords/libwlmio/releases] + +OR build your own package + ``` -apt install devscripts meson libgpiod-dev python3-dev +apt install devscripts meson libgpiod-dev python3-dev debhelper pkg-config debuild -b -us -uc -i ``` diff --git a/debian/postinst b/debian/postinst index 3eb0bba..e0b61e8 100755 --- a/debian/postinst +++ b/debian/postinst @@ -1,3 +1,4 @@ #!/bin/sh -cp /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/overlays/ +cp /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/firmware/overlays/ +cp /usr/share/rpikernelhack/overlays/wlmio-pi5.dtbo /boot/firmware/overlays/ rm -rf /usr/share/rpikernelhack/ diff --git a/debian/postrm b/debian/postrm index 3aa9b7f..c43f849 100755 --- a/debian/postrm +++ b/debian/postrm @@ -1,6 +1,9 @@ #!/bin/sh if test "$1" = remove -a "$1" = abort-install -a "$1" = disappear; then - dpkg-divert --no-rename --remove --package rpikernelhack /boot/overlays/wlmio.dtbo - rm /boot/overlays/wlmio.dtbo + dpkg-divert --no-rename --remove --package rpikernelhack /boot/firmware/overlays/wlmio.dtbo + rm /boot/firmware/overlays/wlmio.dtbo + + dpkg-divert --no-rename --remove --package rpikernelhack /boot/firmware/overlays/wlmio-pi5.dtbo + rm /boot/firmware/overlays/wlmio-pi5.dtbo fi diff --git a/debian/preinst b/debian/preinst index 9181c07..7267394 100755 --- a/debian/preinst +++ b/debian/preinst @@ -1,3 +1,4 @@ #!/bin/sh mkdir -p /usr/share/rpikernelhack/overlays/ -dpkg-divert --no-rename --package rpikernelhack --divert /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/overlays/wlmio.dtbo +dpkg-divert --no-rename --package rpikernelhack --divert /usr/share/rpikernelhack/overlays/wlmio.dtbo /boot/firmware/overlays/wlmio.dtbo +dpkg-divert --no-rename --package rpikernelhack --divert /usr/share/rpikernelhack/overlays/wlmio-pi5.dtbo /boot/firmware/overlays/wlmio-pi5.dtbo diff --git a/overlay/meson.build b/overlay/meson.build index 709cc6b..28adfca 100644 --- a/overlay/meson.build +++ b/overlay/meson.build @@ -6,8 +6,21 @@ overlay = custom_target('wlmio.dtbo', command: [ dtc, '-@', '-I', 'dts', '-O', 'dtb', '-o', '@OUTPUT@', '@INPUT@' ], build_by_default: true, install: true, - install_dir: '/boot/overlays/', + install_dir: '/boot/firmware/overlays/', # install_dir: '/usr/share/rpikernelhack/overlays/', install_mode: ['rwxr-xr-x', 'root', 'root'] # install_mode: 'rwxr-xr-x' ) + +overlay = custom_target('wlmio-pi5.dtbo', + output: 'wlmio-pi5.dtbo', + input: 'wlmio-pi5.dts', + command: [ dtc, '-@', '-I', 'dts', '-O', 'dtb', '-o', '@OUTPUT@', '@INPUT@' ], + build_by_default: true, + install: true, + install_dir: '/boot/firmware/overlays/', + # install_dir: '/usr/share/rpikernelhack/overlays/', + install_mode: ['rwxr-xr-x', 'root', 'root'] + # install_mode: 'rwxr-xr-x' +) + diff --git a/overlay/wlmio-pi5.dts b/overlay/wlmio-pi5.dts new file mode 100644 index 0000000..815d257 --- /dev/null +++ b/overlay/wlmio-pi5.dts @@ -0,0 +1,111 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2712"; + + fragment@0 { + target = <&spi0>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@1 { + target = <&spidev0>; + __overlay__ { + status = "disabled"; + }; + }; + + fragment@2 { + target = <&gpio>; + __overlay__ { + can_pins: can_spi0_0_pins { + brcm,pins = <6 16>; + brcm,function = <0 0>; // GPIO INPUT + brcm,pull = <2 2>; // PULL-UP + }; + }; + }; + + fragment@3 { + target-path = "/clocks"; + __overlay__ { + can_osc: can_spi0_0_osc { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <40000000>; + }; + }; + }; + + fragment@4 { + target = <&spi0>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + + can: mcp2518fd@0 { + compatible = "microchip,mcp2518fd"; + reg = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&can_pins>; + spi-max-frequency = <20000000>; + interrupt-parent = <&gpio>; + interrupts = <6 8>; // IRQ_TYPE_LEVEL_LOW + // interrupts-extended = <&gpio 6 8>; // IRQ_TYPE_LEVEL_LOW + clocks = <&can_osc>; + microchip,rx-int-gpios = <&gpio 16 1>; // GPIO_ACTIVE_LOW + }; + + }; + }; + + fragment@5 { + target = <&i2c_arm>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + mcp7941x: mcp7941x@6f { + compatible = "microchip,mcp7941x"; + reg = <0x6f>; + status = "okay"; + }; + }; + }; + + fragment@6 { + target = <&uart2>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + status = "okay"; + }; + }; + + fragment@7 { + target = <&uart4>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&uart4_pins>; + status = "okay"; + }; + }; + + fragment@8 { + target = <&gpio>; + __overlay__ { + pinctrl-names = "default"; + pinctrl-0 = <&uavcan_address>; + + uavcan_address: uavcan_address { + brcm,pins = <21 22 23 24 25 26 27>; + brcm,function = <0 0 0 0 0 0 0>; // GPIO INPUT + brcm,pull = <2 2 2 2 2 2 2>; // PULL-UP + }; + }; + }; +}; diff --git a/src/tools/meson.build b/src/tools/meson.build index 10a030b..98a3697 100644 --- a/src/tools/meson.build +++ b/src/tools/meson.build @@ -1,13 +1,13 @@ -executable('6040macal', '6040macal.c', dependencies: [wlmio_dep], install: true) -executable('6050cal', '6050cal.c', dependencies: [wlmio_dep], install: true) -executable('6070cal', '6070cal.c', dependencies: [wlmio_dep], install: true) -executable('6090cal', '6090cal.c', dependencies: [wlmio_dep], install: true) -executable('6090ccal', '6090ccal.c', dependencies: [wlmio_dep], install: true) -executable('6180a_cal', '6180a_cal.c', dependencies: [wlmio_dep], install: true) -executable('6190a_conf', '6190a_conf.c', dependencies: [wlmio_dep], install: true) -executable('factoryreset', 'factoryreset.c', dependencies: [wlmio_dep], install: true) -executable('fwupdate', 'fwupdate.c', dependencies: [canard_dep, libgpiod_dep], install: true) -executable('infodump', 'infodump.c', dependencies: [wlmio_dep], install: true) -executable('monitor', 'monitor.c', dependencies: [wlmio_dep], install: true) -executable('regtool', 'regtool.c', dependencies: [wlmio_dep], install: true) -executable('store', 'store.c', dependencies: [wlmio_dep], install: true) +executable('wl_6040macal', '6040macal.c', dependencies: [wlmio_dep], install: true) +executable('wl_6050cal', '6050cal.c', dependencies: [wlmio_dep], install: true) +executable('wl_6070cal', '6070cal.c', dependencies: [wlmio_dep], install: true) +executable('wl_6090cal', '6090cal.c', dependencies: [wlmio_dep], install: true) +executable('wl_6090ccal', '6090ccal.c', dependencies: [wlmio_dep], install: true) +executable('wl_6180a_cal', '6180a_cal.c', dependencies: [wlmio_dep], install: true) +executable('wl_6190a_conf', '6190a_conf.c', dependencies: [wlmio_dep], install: true) +executable('wl_factoryreset', 'factoryreset.c', dependencies: [wlmio_dep], install: true) +executable('wl_fwupdate', 'fwupdate.c', dependencies: [canard_dep, libgpiod_dep], install: true) +executable('wl_infodump', 'infodump.c', dependencies: [wlmio_dep], install: true) +executable('wl_monitor', 'monitor.c', dependencies: [wlmio_dep], install: true) +executable('wl_regtool', 'regtool.c', dependencies: [wlmio_dep], install: true) +executable('wl_store', 'store.c', dependencies: [wlmio_dep], install: true)