1 """Binho Nova pin names"""
 
   5     """A basic Pin class for use with Binho Nova."""
 
  17     def __init__(self, pin_id=None):
 
  19             # pylint: disable=import-outside-toplevel
 
  20             from adafruit_blinka.microcontroller.nova import Connection
 
  22             # pylint: enable=import-outside-toplevel
 
  24             Pin._nova = Connection.getInstance()
 
  25         # check if pin is valid
 
  27             raise ValueError("Invalid pin {}.".format(pin_id))
 
  31     def init(self, mode=IN, pull=None):
 
  32         """Initialize the Pin"""
 
  34             raise RuntimeError("Can not init a None type pin.")
 
  35         # Nova does't have configurable internal pulls for
 
  37             raise ValueError("Internal pull up/down not currently supported.")
 
  38         Pin._nova.setIOpinMode(self.id, mode)
 
  40     def value(self, val=None):
 
  41         """Set or return the Pin Value"""
 
  43             raise RuntimeError("Can not access a None type pin.")
 
  46             return int(Pin._nova.getIOpinValue(self.id).split("VALUE ")[1])
 
  48         if val in (self.LOW, self.HIGH):
 
  49             Pin._nova.setIOpinValue(self.id, val)
 
  51         raise RuntimeError("Invalid value for pin")
 
  54 # create pin instances for each pin
 
  70 # No PWM support on IO1
 
  75 # orderd as (channel, pin), id
 
  76 pwmOuts = (((1, 0), PWM0), ((1, 2), PWM2), ((1, 3), PWM3), ((1, 4), PWM4))
 
  81 # ordered as uartId, txId, rxId
 
  82 uartPorts = ((0, UART1_TX, UART1_RX),)