Adafruit Python Seesaw
|
Public Member Functions | |
def | __init__ (self, addr=0x49, i2c=None, kwargs) |
def | begin (self) |
Start the seesaw. More... | |
def | sw_reset (self) |
perform a software reset. More... | |
def | get_options (self) |
Returns the available options compiled into the seesaw firmware. More... | |
def | get_version (self) |
Returns the version of the seesaw. More... | |
def | pin_mode (self, pin, mode) |
Set the mode of a GPIO pin. More... | |
def | digital_write (self, pin, value) |
Set the output of a GPIO pin. More... | |
def | digital_read (self, pin) |
Read the current status of a GPIO pin. More... | |
def | digital_read_bulk (self, pins) |
read the status of multiple pins. More... | |
def | set_GPIO_interrupts (self, pins, enabled) |
Enable or disable GPIO interrupts on the passed pins. More... | |
def | analog_read (self, pin) |
read the analog value on an ADC-enabled pin. More... | |
def | pin_mode_bulk (self, pins, mode) |
set the mode of multiple GPIO pins at once. More... | |
def | digital_write_bulk (self, pins, value) |
write a value to multiple GPIO pins at once. More... | |
def | analog_write (self, pin, value) |
write a PWM value to a PWM-enabled pin More... | |
def | enable_sercom_data_rdy_interrupt (self, sercom) |
Enable the data ready interrupt on the passed sercom. More... | |
def | disable_sercom_data_rdy_interrupt (self, sercom) |
Disable the data ready interrupt on the passed sercom. More... | |
def | read_sercom_data (self, sercom) |
Reads a character from the passed sercom if one is available. More... | |
def | set_i2c_addr (self, addr) |
Set the seesaw I2C address. More... | |
def | get_i2c_addr (self) |
Read the I2C address of the seesaw. More... | |
def | eeprom_write8 (self, addr, val) |
Write a 1 byte to an EEPROM address. More... | |
def | eeprom_write (self, addr, buf) |
write a string of bytes to EEPROM starting at the passed address More... | |
def | eeprom_read8 (self, addr) |
Read 1 byte from the specified EEPROM address. More... | |
def | uart_set_baud (self, baud) |
Set the baud rate on SERCOM0. More... | |
def | write8 (self, regHigh, regLow, value) |
Write 1 byte to the specified seesaw register. More... | |
def | read8 (self, regHigh, regLow) |
read 1 byte from the specified seesaw register. More... | |
def | read (self, regHigh, regLow, length, delay=.001) |
Read a specified number of bytes from the seesaw. More... | |
def | write (self, regHigh, regLow, buf=None) |
Write a specified number of bytes to the seesaw from the passed buffer. More... | |
Public Attributes | |
addr | |
Static Public Attributes | |
int | INPUT = 0x00 |
int | OUTPUT = 0x01 |
int | INPUT_PULLUP = 0x02 |
def Adafruit_Seesaw.seesaw.Seesaw.analog_read | ( | self, | |
pin | |||
) |
read the analog value on an ADC-enabled pin.
pin | the number of the pin to read. On the SAMD09 breakout, this corresponds to the number on the silkscreen. On the default seesaw firmware on the SAMD09 breakout, pins 2, 3, and 4 are ADC-enabled. |
def Adafruit_Seesaw.seesaw.Seesaw.analog_write | ( | self, | |
pin, | |||
value | |||
) |
write a PWM value to a PWM-enabled pin
pin | the number of the pin to write. On the SAMD09 breakout, this corresponds to the number on the silkscreen. on the default seesaw firmware on the SAMD09 breakout, pins 5, 6, and 7 are PWM enabled. |
value | a number between 0 and 255 to write to the pin. |
def Adafruit_Seesaw.seesaw.Seesaw.begin | ( | self | ) |
Start the seesaw.
This should be called when your sketch is connecting to the seesaw
addr | the I2C address of the seesaw |
def Adafruit_Seesaw.seesaw.Seesaw.digital_read | ( | self, | |
pin | |||
) |
Read the current status of a GPIO pin.
pin | the pin number. On the SAMD09 breakout, this corresponds to the number on the silkscreen. |
def Adafruit_Seesaw.seesaw.Seesaw.digital_read_bulk | ( | self, | |
pins | |||
) |
read the status of multiple pins.
pins | a bitmask of the pins to write. On the SAMD09 breakout, this corresponds to the number on the silkscreen. For example, passing 0b0110 will return the values of pins 2 and 3. |
def Adafruit_Seesaw.seesaw.Seesaw.digital_write | ( | self, | |
pin, | |||
value | |||
) |
Set the output of a GPIO pin.
pin | the pin number. On the SAMD09 breakout, this corresponds to the number on the silkscreen. |
value | the value to write to the GPIO pin. This should be True or False. |
def Adafruit_Seesaw.seesaw.Seesaw.digital_write_bulk | ( | self, | |
pins, | |||
value | |||
) |
write a value to multiple GPIO pins at once.
pins | a bitmask of the pins to write. On the SAMD09 breakout, this corresponds to the number on the silkscreen. For example, passing 0b0110 will write the passed value to pins 2 and 3. |
value | pass True to set the output on the passed pins high, False to set the output on the passed pins low. |
def Adafruit_Seesaw.seesaw.Seesaw.disable_sercom_data_rdy_interrupt | ( | self, | |
sercom | |||
) |
Disable the data ready interrupt on the passed sercom.
sercom | the sercom to disable the interrupt on. |
def Adafruit_Seesaw.seesaw.Seesaw.eeprom_read8 | ( | self, | |
addr | |||
) |
Read 1 byte from the specified EEPROM address.
addr | the address to read from. One the default seesaw firmware on the SAMD09 breakout this is between 0 and 63. |
def Adafruit_Seesaw.seesaw.Seesaw.eeprom_write | ( | self, | |
addr, | |||
buf | |||
) |
write a string of bytes to EEPROM starting at the passed address
addr | the starting address to write the first byte. This will be automatically incremented with each byte written. |
buf | the buffer of bytes to be written. |
def Adafruit_Seesaw.seesaw.Seesaw.eeprom_write8 | ( | self, | |
addr, | |||
val | |||
) |
Write a 1 byte to an EEPROM address.
addr | the address to write to. On the default seesaw firmware on the SAMD09 breakout this is between 0 and 63. |
val | to write between 0 and 255 |
def Adafruit_Seesaw.seesaw.Seesaw.enable_sercom_data_rdy_interrupt | ( | self, | |
sercom | |||
) |
Enable the data ready interrupt on the passed sercom.
Note that both the interrupt module and the passed sercom must be compiled into the seesaw firmware for this to function. If both of these things are true, the interrupt pin on the seesaw will fire when there is data to be read from the passed sercom. On the default seesaw firmeare on the SAMD09 breakout, no sercoms are enabled.
sercom | the sercom to enable the interrupt on. |
def Adafruit_Seesaw.seesaw.Seesaw.get_i2c_addr | ( | self | ) |
Read the I2C address of the seesaw.
def Adafruit_Seesaw.seesaw.Seesaw.get_options | ( | self | ) |
Returns the available options compiled into the seesaw firmware.
def Adafruit_Seesaw.seesaw.Seesaw.get_version | ( | self | ) |
Returns the version of the seesaw.
def Adafruit_Seesaw.seesaw.Seesaw.pin_mode | ( | self, | |
pin, | |||
mode | |||
) |
Set the mode of a GPIO pin.
pin | the pin number. On the SAMD09 breakout, this corresponds to the number on the silkscreen. |
mode | the mode to set the pin. One of Seesaw.INPUT, Seesaw.OUTPUT, or Seesaw.INPUT_PULLUP. |
def Adafruit_Seesaw.seesaw.Seesaw.pin_mode_bulk | ( | self, | |
pins, | |||
mode | |||
) |
set the mode of multiple GPIO pins at once.
pins | a bitmask of the pins to write. On the SAMD09 breakout, this corresponds to the number on the silkscreen. For example, passing 0b0110 will set the mode of pins 2 and 3. |
mode | the mode to set the pins to. One of Seesaw.INPUT, Seesaw.OUTPUT, or Seesaw.INPUT_PULLUP. |
def Adafruit_Seesaw.seesaw.Seesaw.read | ( | self, | |
regHigh, | |||
regLow, | |||
length, | |||
delay = .001 |
|||
) |
Read a specified number of bytes from the seesaw.
regHigh | the module address register (ex. SEESAW_STATUS_BASE) |
regLow | the function address register (ex. SEESAW_STATUS_VERSION) |
num | the number of bytes to read. |
delay | an optional delay (seconds) in between setting the read register and reading out the data. This is required for some seesaw functions (ex. reading ADC data) |
def Adafruit_Seesaw.seesaw.Seesaw.read8 | ( | self, | |
regHigh, | |||
regLow | |||
) |
read 1 byte from the specified seesaw register.
regHigh | the module address register (ex. SEESAW_STATUS_BASE) |
regLow | the function address register (ex. SEESAW_STATUS_VERSION) |
def Adafruit_Seesaw.seesaw.Seesaw.read_sercom_data | ( | self, | |
sercom | |||
) |
Reads a character from the passed sercom if one is available.
Note that on the default seesaw firmware on the SAMD09 breakout no sercoms are enabled.
sercom | the sercom to read data from. |
def Adafruit_Seesaw.seesaw.Seesaw.set_GPIO_interrupts | ( | self, | |
pins, | |||
enabled | |||
) |
Enable or disable GPIO interrupts on the passed pins.
pins | a bitmask of the pins to write. On the SAMD09 breakout, this corresponds to the number on the silkscreen. For example, passing 0b0110 will enable or disable interrups on pins 2 and 3. |
enabled | pass true to enable the interrupts on the passed pins, false to disable the interrupts on the passed pins. |
def Adafruit_Seesaw.seesaw.Seesaw.set_i2c_addr | ( | self, | |
addr | |||
) |
Set the seesaw I2C address.
This will automatically call Adafruit_seesaw.begin() with the new address.
addr | the new address for the seesaw. This must be a valid 7 bit I2C address. |
def Adafruit_Seesaw.seesaw.Seesaw.sw_reset | ( | self | ) |
perform a software reset.
This resets all seesaw registers to their default values.
This is called automatically from Adafruit_seesaw.begin()
def Adafruit_Seesaw.seesaw.Seesaw.uart_set_baud | ( | self, | |
baud | |||
) |
Set the baud rate on SERCOM0.
baud | the baud rate to set. This is an integer value. Baud rates up to 115200 are supported. |
def Adafruit_Seesaw.seesaw.Seesaw.write | ( | self, | |
regHigh, | |||
regLow, | |||
buf = None |
|||
) |
Write a specified number of bytes to the seesaw from the passed buffer.
regHigh | the module address register (ex. SEESAW_GPIO_BASE) |
regLow | the function address register (ex. SEESAW_GPIO_BULK_SET) |
buf | the buffer the the bytes from |
def Adafruit_Seesaw.seesaw.Seesaw.write8 | ( | self, | |
regHigh, | |||
regLow, | |||
value | |||
) |
Write 1 byte to the specified seesaw register.
regHigh | the module address register (ex. SEESAW_NEOPIXEL_BASE) |
regLow | the function address register (ex. SEESAW_NEOPIXEL_PIN) |
value | the value between 0 and 255 to write |