Adafruit Python Seesaw
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Adafruit_Seesaw.seesaw.Seesaw Class Reference
Inheritance diagram for Adafruit_Seesaw.seesaw.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
 

Member Function Documentation

◆ analog_read()

def Adafruit_Seesaw.seesaw.Seesaw.analog_read (   self,
  pin 
)

read the analog value on an ADC-enabled pin.

Parameters
pinthe 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.
Returns
the analog value. This is an integer between 0 and 1023

◆ analog_write()

def Adafruit_Seesaw.seesaw.Seesaw.analog_write (   self,
  pin,
  value 
)

write a PWM value to a PWM-enabled pin

Parameters
pinthe 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.
valuea number between 0 and 255 to write to the pin.
Returns
none

◆ begin()

def Adafruit_Seesaw.seesaw.Seesaw.begin (   self)

Start the seesaw.

This should be called when your sketch is connecting to the seesaw

Parameters
addrthe I2C address of the seesaw
Returns
true if we could connect to the seesaw, false otherwise

◆ digital_read()

def Adafruit_Seesaw.seesaw.Seesaw.digital_read (   self,
  pin 
)

Read the current status of a GPIO pin.

Parameters
pinthe pin number. On the SAMD09 breakout, this corresponds to the number on the silkscreen.
Returns
the status of the pin. HIGH or LOW (1 or 0).

◆ digital_read_bulk()

def Adafruit_Seesaw.seesaw.Seesaw.digital_read_bulk (   self,
  pins 
)

read the status of multiple pins.

Parameters
pinsa 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.
Returns
the status of the passed pins. If 0b0110 was passed and pin 2 is high and pin 3 is low, 0b0010 (decimal number 2) will be returned.

◆ digital_write()

def Adafruit_Seesaw.seesaw.Seesaw.digital_write (   self,
  pin,
  value 
)

Set the output of a GPIO pin.

Parameters
pinthe pin number. On the SAMD09 breakout, this corresponds to the number on the silkscreen.
valuethe value to write to the GPIO pin. This should be True or False.
Returns
none

◆ digital_write_bulk()

def Adafruit_Seesaw.seesaw.Seesaw.digital_write_bulk (   self,
  pins,
  value 
)

write a value to multiple GPIO pins at once.

Parameters
pinsa 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.
valuepass True to set the output on the passed pins high, False to set the output on the passed pins low.
Returns
none

◆ disable_sercom_data_rdy_interrupt()

def Adafruit_Seesaw.seesaw.Seesaw.disable_sercom_data_rdy_interrupt (   self,
  sercom 
)

Disable the data ready interrupt on the passed sercom.

Parameters
sercomthe sercom to disable the interrupt on.
Returns
none

◆ eeprom_read8()

def Adafruit_Seesaw.seesaw.Seesaw.eeprom_read8 (   self,
  addr 
)

Read 1 byte from the specified EEPROM address.

Parameters
addrthe address to read from. One the default seesaw firmware on the SAMD09 breakout this is between 0 and 63.
Returns
the value between 0 and 255 that was read from the passed address.

◆ eeprom_write()

def Adafruit_Seesaw.seesaw.Seesaw.eeprom_write (   self,
  addr,
  buf 
)

write a string of bytes to EEPROM starting at the passed address

Parameters
addrthe starting address to write the first byte. This will be automatically incremented with each byte written.
bufthe buffer of bytes to be written.
Returns
none

◆ eeprom_write8()

def Adafruit_Seesaw.seesaw.Seesaw.eeprom_write8 (   self,
  addr,
  val 
)

Write a 1 byte to an EEPROM address.

Parameters
addrthe address to write to. On the default seesaw firmware on the SAMD09 breakout this is between 0 and 63.
valto write between 0 and 255
Returns
none

◆ enable_sercom_data_rdy_interrupt()

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.

Parameters
sercomthe sercom to enable the interrupt on.
Returns
none

◆ get_i2c_addr()

def Adafruit_Seesaw.seesaw.Seesaw.get_i2c_addr (   self)

Read the I2C address of the seesaw.

Returns
the 7 bit I2C address of the seesaw... which you probably already know because you just read data from it.

◆ get_options()

def Adafruit_Seesaw.seesaw.Seesaw.get_options (   self)

Returns the available options compiled into the seesaw firmware.

Returns
the available options compiled into the seesaw firmware. If the option is included, the corresponding bit is set. For example, if the ADC module is compiled in then (ss.getOptions() & (1UL << SEESAW_ADC_BASE)) > 0

◆ get_version()

def Adafruit_Seesaw.seesaw.Seesaw.get_version (   self)

Returns the version of the seesaw.

Returns
The version code. Bits [31:16] will be a date code, [15:0] will be the product id.

◆ pin_mode()

def Adafruit_Seesaw.seesaw.Seesaw.pin_mode (   self,
  pin,
  mode 
)

Set the mode of a GPIO pin.

Parameters
pinthe pin number. On the SAMD09 breakout, this corresponds to the number on the silkscreen.
modethe mode to set the pin. One of Seesaw.INPUT, Seesaw.OUTPUT, or Seesaw.INPUT_PULLUP.
Returns
none

◆ pin_mode_bulk()

def Adafruit_Seesaw.seesaw.Seesaw.pin_mode_bulk (   self,
  pins,
  mode 
)

set the mode of multiple GPIO pins at once.

Parameters
pinsa 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.
modethe mode to set the pins to. One of Seesaw.INPUT, Seesaw.OUTPUT, or Seesaw.INPUT_PULLUP.
Returns
none

◆ read()

def Adafruit_Seesaw.seesaw.Seesaw.read (   self,
  regHigh,
  regLow,
  length,
  delay = .001 
)

Read a specified number of bytes from the seesaw.

Parameters
regHighthe module address register (ex. SEESAW_STATUS_BASE)
regLowthe function address register (ex. SEESAW_STATUS_VERSION)
numthe number of bytes to read.
delayan 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)
Returns
the buffer of bytes read

◆ read8()

def Adafruit_Seesaw.seesaw.Seesaw.read8 (   self,
  regHigh,
  regLow 
)

read 1 byte from the specified seesaw register.

Parameters
regHighthe module address register (ex. SEESAW_STATUS_BASE)
regLowthe function address register (ex. SEESAW_STATUS_VERSION)
Returns
the value between 0 and 255 read from the passed register

◆ read_sercom_data()

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.

Parameters
sercomthe sercom to read data from.
Returns
a character read from the sercom.

◆ set_GPIO_interrupts()

def Adafruit_Seesaw.seesaw.Seesaw.set_GPIO_interrupts (   self,
  pins,
  enabled 
)

Enable or disable GPIO interrupts on the passed pins.

Parameters
pinsa 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.
enabledpass true to enable the interrupts on the passed pins, false to disable the interrupts on the passed pins.
Returns
none

◆ set_i2c_addr()

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.

Parameters
addrthe new address for the seesaw. This must be a valid 7 bit I2C address.
Returns
none

◆ sw_reset()

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()
Returns
none

◆ uart_set_baud()

def Adafruit_Seesaw.seesaw.Seesaw.uart_set_baud (   self,
  baud 
)

Set the baud rate on SERCOM0.

Parameters
baudthe baud rate to set. This is an integer value. Baud rates up to 115200 are supported.
Returns
none

◆ write()

def Adafruit_Seesaw.seesaw.Seesaw.write (   self,
  regHigh,
  regLow,
  buf = None 
)

Write a specified number of bytes to the seesaw from the passed buffer.

Parameters
regHighthe module address register (ex. SEESAW_GPIO_BASE)
regLowthe function address register (ex. SEESAW_GPIO_BULK_SET)
bufthe buffer the the bytes from
Returns
none

◆ write8()

def Adafruit_Seesaw.seesaw.Seesaw.write8 (   self,
  regHigh,
  regLow,
  value 
)

Write 1 byte to the specified seesaw register.

Parameters
regHighthe module address register (ex. SEESAW_NEOPIXEL_BASE)
regLowthe function address register (ex. SEESAW_NEOPIXEL_PIN)
valuethe value between 0 and 255 to write
Returns
none

The documentation for this class was generated from the following file: