Пример #1
0
    def __init__(self, onChange=None):
        self.onChange = onChange

        # Get the hardware assets to control the IO.
        self.regs = regmaps.ioInterface()
        self.io1Pwm = pychronos.pwm(1, 10000, 0.366)
        self.io2Pwm = pychronos.pwm(2, 10000, 0.366)
Пример #2
0
    def __init__(
        self,
        board={
            "lux1310-spidev": "/dev/spidev3.0",
            "lux1310-dac-cs": "/sys/class/gpio/gpio33/value",
            "lux1310-color": "/sys/class/gpio/gpio34/value"
        }):
        ## Hardware Resources
        self.spidev = board["lux1310-spidev"]
        self.spics = board["lux1310-dac-cs"]
        self.board = board
        self.regs = lux1310regs.lux1310regs()
        self.wavetables = lux1310wt.wavetables
        self.timing = lux1310timing.lux1310timing()
        self.io = ioInterface()

        ## ADC Calibration state
        self.adcOffsets = [0] * self.ADC_CHANNELS

        ## Save the real resolution for when cal is in progress.
        self.fSizeReal = None

        self.currentProgram = self.timing.PROGRAM_STANDARD
        self.frameClocks = int(0.001 * self.LUX1310_SENSOR_HZ)
        self.exposureClocks = int(self.frameClocks * 0.95)

        self.__currentGain = 1
        self.__currentWavetable = self.wavetables[0]

        super().__init__()
Пример #3
0
    def __init__(self):
        super().__init__()

        # make sure some sane values are in the internal backing
        # registers in case the user just sets the integration and frame times
        self.__program = self.PROGRAM_NONE
        self.__t2time = 17
        self.__txnWidth = 50

        self.io = ioInterface()
Пример #4
0
    def __init__(self, bus, path, mainloop, camera):
        # FIXME: This seems hacky, just calling the class method directly.
        # Shouldn't we be using a super() call somehow?
        dbus.service.Object.__init__(self, bus, path)
        self.bus = bus
        self.mainloop = mainloop

        self.camera = camera
        self.io = regmaps.ioInterface()
        self.display = regmaps.display()

        self.currentState = 'idle'
        self.description = "Chronos SN:%s" % (self.camera.getSerialNumber())
        self.idNumber = None

        self.callLater(0.5, self.doReset, {'reset': True, 'sensor': True})
Пример #5
0
    def __init__(self, bus, path, mainloop, camera, configFile=None):
        # FIXME: This seems hacky, just calling the class method directly.
        # Shouldn't we be using a super() call somehow?
        dbus.service.Object.__init__(self, bus, path)
        self.bus = bus
        self.mainloop = mainloop
        self.configFile = configFile
        self.calLocation = "/var/camera/cal"
    
        self.camera = camera
        self.video = bus.get_object('ca.krontech.chronos.video', '/ca/krontech/chronos/video')
        self.io = regmaps.ioInterface()
        self.display = regmaps.display()

        # Try creating the calibration directory if it doesn't exist.
        try:
            os.makedirs(self.calLocation, exist_ok=True)
        except OSError as e:
            logging.info("Unable to create calibration directory at %s: %s", self.calLocation, e)

        # Install a callback to catch parameter and state changes.
        self.camera.setOnChange(self.onChangeHandler)
        self.changeset = None
        self.changecfg = False

        # Args to pass on down to the reboot logic.
        self.rebootMode = {}

        # Install a callback to catch video signals.
        self.video.connect_to_signal('sof', self.videoSofSignal)
        self.video.connect_to_signal('eof', self.videoEofSignal)
        self.video.connect_to_signal('segment', self.videoSegmentSignal)
        self.video.connect_to_signal('update', self.videoUpdateSignal)

        # Perform a reset as soon as the GLib mainloop gets running.
        self.runGenerator(self.runSoftReset())