def __init__(self, portid, baudrate=9600, bits=8, parity=None, stop=1, timeout=1000, read_buf_len=None, flow=None): from adafruit_blinka.microcontroller.nova import Connection self._nova = Connection.getInstance() self._id = portid self._baudrate = baudrate self._parity = parity self._bits = bits self._stop = stop self._timeout = timeout if flow is not None: # default 0 raise NotImplementedError( "Parameter '{}' unsupported on Binho Nova".format("flow")) self._nova.setOperationMode(self._id, 'UART') self._nova.setBaudRateUART(self._id, baudrate) self._nova.setDataBitsUART(self._id, bits) self._nova.setParityUART(self._id, parity) self._nova.setStopBitsUART(self._id, stop) self._nova.setEscapeSequenceUART(self._id, UART.ESCAPE_SEQUENCE) self._nova.beginBridgeUART(self._id)
def __init__(self, pin, *, frequency=750, duty_cycle=0, variable_frequency=False): """Instantiate a PWM object and open the sysfs PWM corresponding to the specified channel and pin. Args: pin (Pin): CircuitPython Pin object to output to duty_cycle (int) : The fraction of each pulse which is high. 16-bit frequency (int) : target frequency in Hertz (32-bit) variable_frequency (bool) : True if the frequency will change over time Returns: PWMOut: PWMOut object. Raises: PWMError: if an I/O or OS error occurs. TypeError: if `channel` or `pin` types are invalid. ValueError: if PWM channel does not exist. """ if PWMOut._nova is None: # pylint: disable=import-outside-toplevel from adafruit_blinka.microcontroller.nova import Connection # pylint: enable=import-outside-toplevel PWMOut._nova = Connection.getInstance() PWMOut._nova.setOperationMode(0, "IO") self._pwmpin = None self._channel = None self._enable = False self._open(pin, duty_cycle, frequency, variable_frequency)
def __init__(self): from adafruit_blinka.microcontroller.nova import Connection self._nova = Connection.getInstance() self._nova.setNumericalBase(10) self._nova.setOperationMode(0, "I2C") self._nova.setPullUpStateI2C(0, "EN") self._nova.setClockI2C(0, 400000)
def __init__(self, pin_id=None): if not Pin._nova: from adafruit_blinka.microcontroller.nova import Connection Pin._nova = Connection.getInstance() # check if pin is valid if pin_id > 4: raise ValueError("Invalid pin {}.".format(pin_id)) self.id = pin_id
def __init__(self, clock): self._nova = Connection.getInstance() self._nova.setNumericalBase(10) self._nova.setOperationMode(0, "SPI") self._nova.setClockSPI(0, clock) self._nova.setModeSPI(0, 0) self._nova.setIOpinMode(0, "DOUT") self._nova.setIOpinMode(1, "DOUT") self._nova.beginSPI(0)
def __init__(self, clock): from adafruit_blinka.microcontroller.nova import Connection self._nova = Connection.getInstance() self._nova.setNumericalBase(10) self._nova.setOperationMode(0, 'SPI') self._nova.setClockSPI(0, clock) self._nova.setModeSPI(0, 0) self._nova.setIOpinMode(0, 'DOUT') self._nova.setIOpinMode(1, 'DOUT') self._nova.beginSPI(0)
def __init__(self, *, frequency=400000): self._nova = Connection.getInstance() self._nova.setNumericalBase(10) self._nova.setOperationMode(0, "I2C") self._nova.setPullUpStateI2C(0, "EN") self._nova.setClockI2C(0, frequency) self._novaCMDVer = "0" if hasattr(self._nova, "getCommandVer"): response = self._nova.getCommandVer().split(" ") if response[0] != "-NG": self._novaCMDVer = response[1]
def __init__(self, pin_id=None): if not Pin._nova: # pylint: disable=import-outside-toplevel from adafruit_blinka.microcontroller.nova import Connection # pylint: enable=import-outside-toplevel Pin._nova = Connection.getInstance() # check if pin is valid if pin_id > 4: raise ValueError("Invalid pin {}.".format(pin_id)) self.id = pin_id
def __init__(self, clock): self._nova = Connection.getInstance() self._nova.setNumericalBase(10) self._nova.setOperationMode(0, "SPI") self._nova.setClockSPI(0, clock) self._nova.setModeSPI(0, 0) self._nova.setIOpinMode(0, "DOUT") self._nova.setIOpinMode(1, "DOUT") self._nova.beginSPI(0) self._novaCMDVer = "0" if hasattr(self._nova, "getCommandVer"): response = self._nova.getCommandVer().split(" ") if response[0] != "-NG": self._novaCMDVer = response[1]
def __init__(self, *, frequency=400000): self._nova = Connection.getInstance() self._nova.setNumericalBase(10) self._nova.setOperationMode(0, "I2C") self._nova.setPullUpStateI2C(0, "EN") self._nova.setClockI2C(0, frequency)