예제 #1
0
def getAinPinName(pin):
  hits = glob("/sys/bus/iio/devices/iio:device?/in_voltage%s_raw" % pin)
  if hits:
    return hits[0]
  else:
    log.fatal("Could not find ADC pin %s, double check that the firmware loaded..." % pin)
    from pwm_utilities import stopEverythingAndQuit
    stopEverythingAndQuit()
예제 #2
0
def safeRun(main):
  setupSignalHandlers()
  try:
    main()
  except Exception:
    # no matter what everything should stop, so catch everything
    err = traceback.format_exc()
    log.error("Something's gone horribly wrong!  %s" % err)
  from pwm_utilities import stopEverythingAndQuit
  stopEverythingAndQuit()
예제 #3
0
def getAinPinName(pin):
    hits = glob("/sys/bus/iio/devices/iio:device?/in_voltage%s_raw" % pin)
    if hits:
        return hits[0]
    else:
        log.fatal(
            "Could not find ADC pin %s, double check that the firmware loaded..."
            % pin)
        from pwm_utilities import stopEverythingAndQuit
        stopEverythingAndQuit()
예제 #4
0
def setupSignalHandlers():
  import signal
  from pwm_utilities import stopEverythingAndQuit
  signal.signal(signal.SIGABRT, lambda a,b: stopEverythingAndQuit())
  signal.signal(signal.SIGINT, lambda a,b: stopEverythingAndQuit())
  signal.signal(signal.SIGQUIT, lambda a,b: stopEverythingAndQuit())