Example #1
0
 def __init__(self):
   """Initialize a new instance of the Bus class.  This will access the
   Aardvark API and open the first available Aardvark USB device.  If no
   device is available, an exception will be raised.
   """
   self._port = _find_aardvark()
   self._open = False
   self._handle = _check_result(api.aa_open(self._port))
   self._open = True
   _check_result(api.aa_configure(self._handle, api.AA_CONFIG_GPIO_I2C)) # AA_CONFIG_SPI_I2C
   _check_result(api.aa_i2c_pullup(self._handle, api.AA_I2C_PULLUP_BOTH))
   _check_result(api.aa_i2c_bitrate(self._handle, 100))
   _check_result(api.aa_gpio_set(self._handle, 0x00)) # Initialize to zeros
   _check_result(api.aa_gpio_direction(self._handle, 0xFF)) # All outputs
Example #2
0
 def __init__(self):
     """Initialize a new instance of the Bus class.  This will access the
 Aardvark API and open the first available Aardvark USB device.  If no
 device is available, an exception will be raised.
 """
     self._port = _find_aardvark()
     self._open = False
     self._handle = _check_result(api.aa_open(self._port))
     self._open = True
     _check_result(api.aa_configure(
         self._handle, api.AA_CONFIG_GPIO_I2C))  # AA_CONFIG_SPI_I2C
     _check_result(api.aa_i2c_pullup(self._handle, api.AA_I2C_PULLUP_BOTH))
     _check_result(api.aa_i2c_bitrate(self._handle, 100))
     _check_result(api.aa_gpio_set(self._handle,
                                   0x00))  # Initialize to zeros
     _check_result(api.aa_gpio_direction(self._handle, 0xFF))  # All outputs
Example #3
0
 def gpio_set(self, bitmask):
     result = api.aa_gpio_set(self._handle, int(bitmask))
     return _check_result(result)
Example #4
0
 def gpio_set(self, bitmask):
   result = api.aa_gpio_set(self._handle, int(bitmask))
   return _check_result(result)