from config_class import Configuration from log_class import Log config = Configuration() log = Log() pullupdown = ['DOWN', 'UP'] print("Test Button Class") if pwd.getpwuid(os.geteuid()).pw_uid > 0: print("This program must be run with sudo or root permissions!") sys.exit(1) # Get configuration left_switch = config.getSwitchGpio("left_switch") right_switch = config.getSwitchGpio("right_switch") mute_switch = config.getSwitchGpio("mute_switch") down_switch = config.getSwitchGpio("down_switch") up_switch = config.getSwitchGpio("up_switch") menu_switch = config.getSwitchGpio("menu_switch") print("Left switch GPIO", left_switch) print("Right switch GPIO", right_switch) print("Up switch GPIO", up_switch) print("Down switch GPIO", down_switch) print("Mute switch GPIO", mute_switch) print("Menu switch GPIO", menu_switch) print("Pull Up/Down resistors", pullupdown[config.pull_up_down]) Button(left_switch, interrupt, log, config.pull_up_down)
from config_class import Configuration from log_class import Log config = Configuration() log = Log() if pwd.getpwuid(os.geteuid()).pw_uid > 0: print("This program must be run with sudo or root permissions!") sys.exit(1) print("Test Cosmic Controller Class") getConfig = False # Get configuration if getConfig: left_switch = config.getSwitchGpio("left_switch") right_switch = config.getSwitchGpio("right_switch") mute_switch = config.getSwitchGpio("mute_switch") up_switch = config.getSwitchGpio("up_switch") down_switch = config.getSwitchGpio("down_switch") menu_switch = config.getSwitchGpio("menu_switch") print("Left switch GPIO", left_switch) print("Right switch GPIO", right_switch) print("Up switch GPIO", up_switch) print("Down switch GPIO", down_switch) print("Mute switch GPIO", mute_switch) print("Menu switch GPIO", menu_switch) Button(down_switch, interrupt, log) Button(up_switch, interrupt, log)