bcm2837-rpi-zero-2-w.dtb usr/share/quantimotor
+enable_ads.py usr/share/quantimotor
+quantimotor.conf etc/modules-load.d
raspi-extra-cmdline etc/default
raspi-firmware-custom etc/default
+startup usr/share/quantimotor
z99-quantimotor etc/kernel/postinst.d
--- /dev/null
+#!/usr/bin/env python3
+# Copyright (C) 2025 Bdale Garbee <bdale@gag.com>. GPLv3+
+
+import gpiod
+import iio
+import signal
+import sys
+import time
+
+ctx = iio.LocalContext()
+ctrl = ctx.find_device('ads8688')
+
+# configuration for each channel on ADS8688
+OFFSET = "0"
+SCALE = "0.078127104"
+VOLTAGES = ['voltage0', 'voltage1', 'voltage2', 'voltage3', 'voltage4', 'voltage5', 'voltage6', 'voltage7']
+
+from gpiod.line import Direction, Value
+
+def set_line_values(chip_path, line_values):
+ value_str = {Value.ACTIVE: "Active", Value.INACTIVE: "Inactive"}
+
+ request = gpiod.request_lines(
+ chip_path,
+ consumer=sys.argv[0],
+ config={
+ tuple(line_values.keys()): gpiod.LineSettings(direction=Direction.OUTPUT)
+ },
+ )
+ request.set_values(line_values)
+
+if __name__ == "__main__":
+ try:
+ # initialize hardware
+ set_line_values(
+ "/dev/gpiochip0",
+ {25: Value.ACTIVE, # take ADS8688 out of reset
+ 4: Value.ACTIVE, # indicate 'ready' to LPC
+ 16: Value.INACTIVE, # pyro off
+ 17: Value.INACTIVE, # alarm b off
+ 20: Value.INACTIVE, # turn continuity LED off
+ 21: Value.INACTIVE, # turn armed LED off
+ 27: Value.INACTIVE # alarm a off
+ }
+ )
+
+ # configure ADC channels
+ for id in VOLTAGES:
+ chan = ctrl.find_channel(id)
+ # must set scale before offset, so offset 0 is valid!
+ chan.attrs['scale'].value = SCALE
+ chan.attrs['offset'].value = OFFSET
+
+ print('ADS set up .. do your thing!')
+
+
+ except OSError as ex:
+ print(ex, "\nD'oh!")
+