#
import os
-
import cherrypy
from cherrypy.lib.static import serve_file
+import gpiod
+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)
+
path = os.path.abspath(os.path.dirname(__file__))
config = {
'global' : {
if __name__ == '__main__':
+ # 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, # continuity LED off
+ 21: Value.INACTIVE, # armed LED off
+ 27: Value.INACTIVE # alarm a off
+ }
+ )
+
+ # launch web user interface
cherrypy.quickstart(App(), '/', config)