adafruit_seesaw.seesaw

An I2C to whatever helper chip.

  • Author(s): Dean Miller

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_seesaw.seesaw.Seesaw(i2c_bus, addr=73, drdy=None)[source]

Driver for Seesaw i2c generic conversion trip

Parameters:
  • i2c_bus (I2C) – Bus the SeeSaw is connected to
  • addr (int) – I2C address of the SeeSaw device
  • drdy (DigitalInOut) – Pin connected to SeeSaw’s ‘ready’ output
analog_read(pin)[source]

Read the value of an analog pin by number

analog_write(pin, value)[source]

Set the value of an analog output by number

digital_read(pin)[source]

Get the value of an input pin by number

digital_read_bulk(pins, delay=0.008)[source]

Get the values of all the pins on the ‘A’ port as a bitmask

digital_read_bulk_b(pins, delay=0.008)[source]

Get the values of all the pins on the ‘B’ port as a bitmask

digital_write(pin, value)[source]

Set the value of an output pin by number

digital_write_bulk(pins, value)[source]

Set the mode of pins on the ‘A’ port as a bitmask

digital_write_bulk_b(pins, value)[source]

Set the mode of pins on the ‘B’ port as a bitmask

disable_encoder_interrupt(encoder=0)[source]

Disable the interrupt from firing when the encoder changes

eeprom_read8(addr)[source]

Read a single byte directly to the device’s EEPROM

eeprom_write(addr, buf)[source]

Write multiple bytes directly to the device’s EEPROM

eeprom_write8(addr, val)[source]

Write a single byte directly to the device’s EEPROM

enable_encoder_interrupt(encoder=0)[source]

Enable the interrupt to fire when the encoder changes position

encoder_delta(encoder=0)[source]

The change in encoder position since it was last read

encoder_position(encoder=0)[source]

The current position of the encoder

get_GPIO_interrupt_flag(delay=0.008)[source]

Read and clear GPIO interrupts that have fired

get_i2c_addr()[source]

Return the device’s I2C address stored in its EEPROM

get_options()[source]

Retrieve the ‘options’ word from the SeeSaw board

get_temp()[source]

Read the temperature

get_version()[source]

Retrieve the ‘version’ word from the SeeSaw board

moisture_read()[source]

Read the value of the moisture sensor

pin_mode(pin, mode)[source]

Set the mode of a pin by number

pin_mode_bulk(pins, mode)[source]

Set the mode of all the pins on the ‘A’ port as a bitmask

pin_mode_bulk_b(pins, mode)[source]

Set the mode of all the pins on the ‘B’ port as a bitmask

read(reg_base, reg, buf, delay=0.008)[source]

Read an arbitrary I2C register range on the device

read8(reg_base, reg)[source]

Read an arbitrary I2C byte register on the device

set_GPIO_interrupts(pins, enabled)[source]

Enable or disable the GPIO interrupt

set_encoder_position(pos, encoder=0)[source]

Set the current position of the encoder

set_i2c_addr(addr)[source]

Store a new address in the device’s EEPROM and reboot it.

set_pwm_freq(pin, freq)[source]

Set the PWM frequency of a pin by number

sw_reset()[source]

Trigger a software reset of the SeeSaw chip

touch_read(pin)[source]

Read the value of a touch pin by number

uart_set_baud(baud)[source]

Set the serial baudrate of the device

write(reg_base, reg, buf=None)[source]

Write an arbitrary I2C register range on the device

write8(reg_base, reg, value)[source]

Write an arbitrary I2C byte register on the device

adafruit_seesaw.crickit - Pin definition for Adafruit CRICKIT

adafruit_seesaw.analoginput

class adafruit_seesaw.analoginput.AnalogInput(seesaw, pin)[source]

CircuitPython-compatible class for analog inputs

This class is intended to be a compatible subset of analogio.AnalogIn

Parameters:
  • seesaw (Seesaw) – The device
  • pin (int) – The pin number on the device
reference_voltage

The reference voltage for the pin

value

The current analog value on the pin, as an integer from 0..65535 (inclusive)

adafruit_seesaw.digitalio

class adafruit_seesaw.digitalio.DigitalIO(seesaw, pin)[source]

CircuitPython-compatible class for digital I/O pins

This class is intended to be a compatible subset of digitalio.DigitalInOut.

Due to technical limitations, PULL_DOWNs are not supported.

Parameters:
  • seesaw (Seesaw) – The device
  • pin (int) – The pin number on the device
direction

Retrieve or set the direction of the pin

drive_mode

Retrieve or set the drive mode of an output pin

pull

Retrieve or set the pull mode of an input pin

switch_to_input(pull=None)[source]

Switch the pin to input mode

switch_to_output(value=False, drive_mode=<sphinx.ext.autodoc.importer._MockObject object>)[source]

Switch the pin to output mode

value

Retrieve or set the value of the pin

adafruit_seesaw.keypad

class adafruit_seesaw.keypad.KeyEvent(num, edge)[source]

Holds information about a key event in its properties

Parameters:
class adafruit_seesaw.keypad.Keypad(i2c_bus, addr=73, drdy=None)[source]

On compatible SeeSaw devices, reads from a keypad.

Parameters:
  • i2c_bus (I2C) – Bus the SeeSaw is connected to
  • addr (int) – I2C address of the SeeSaw device
  • drdy (DigitalInOut) – Pin connected to SeeSaw’s ‘ready’ output
EDGE_FALLING = 2

Indicates that the key was recently pressed

EDGE_HIGH = 0

Indicates that the key is currently pressed

EDGE_LOW = 1

Indicates that the key is currently released

EDGE_RISING = 3

Indicates that the key was recently released

count

Retrieve or set the number of keys

interrupt_enabled

Retrieve or set the interrupt enable flag

read_keypad(num)[source]

Read data from the keypad

Parameters:num (int) – The number of bytes to read
set_event(key, edge, enable)[source]

Control which kinds of events are set

Parameters:
  • key (int) – The key number
  • edge (int) – The type of event
  • enable (bool) – True to enable the event, False to disable it

adafruit_seesaw.neopixel

adafruit_seesaw.neopixel.GRB = (1, 0, 2)

Green Red Blue

adafruit_seesaw.neopixel.GRBW = (1, 0, 2, 3)

Green Red Blue White

class adafruit_seesaw.neopixel.NeoPixel(seesaw, pin, n, *, bpp=3, brightness=1.0, auto_write=True, pixel_order=None)[source]

Control NeoPixels connected to a seesaw

Parameters:
  • seesaw (Seesaw) – The device
  • pin (int) – The pin number on the device
  • n (int) – The number of pixels
  • bpp (int) – The number of bytes per pixel
  • brightness (float) – The brightness, from 0.0 to 1.0
  • auto_write (bool) – Automatically update the pixels when changed
  • pixel_order (tuple) – The layout of the pixels. Use one of the order constants such as RGBW.
__setitem__(key, color)[source]

Set one pixel to a new value

brightness

Overall brightness of the pixel

fill(color)[source]

Set all pixels to the same value

show()[source]

Update the pixels even if auto_write is False

adafruit_seesaw.neopixel.RGB = (0, 1, 2)

Red Green Blue

adafruit_seesaw.neopixel.RGBW = (0, 1, 2, 3)

Red Green Blue White

adafruit_seesaw.pwmout

class adafruit_seesaw.pwmout.PWMOut(seesaw, pin)[source]

A single seesaw channel that matches the PWMOut API.

duty_cycle

16-bit value that dictates how much of one cycle is high (1) versus low (0). 65535 (0xffff) will always be high, 0 will always be low, and 32767 (0x7fff) will be half high and then half low.

fraction

Expresses duty_cycle as a fractional value. Ranges from 0.0-1.0.

frequency

The overall PWM frequency in Hertz.

adafruit_seesaw.robohat - Pin definition for RoboHAT

class adafruit_seesaw.robohat.MM1_Pinmap[source]

This class is automatically used by adafruit_seesaw.seesaw.Seesaw when a RoboHAT board is detected.

It is also a reference for the capabilities of each pin.

analog_pins = (35, 34)

The pins capable of analog output

pwm_pins = (16, 17, 18, 19, 11, 10, 9, 8, 40, 41, 42, 43)

The pins capable of PWM output

pwm_width = 16

The effective bit resolution of the PWM pins

touch_pins = (7, 6, 5, 4)

The pins capable of touch input

adafruit_seesaw.rotaryio

class adafruit_seesaw.rotaryio.IncrementalEncoder(seesaw, encoder=0)[source]

IncrementalEncoder determines the relative rotational position based on two series of pulses.

position

The current position in terms of pulses. The number of pulses per rotation is defined by the specific hardware.

adafruit_seesaw.samd09 - Pin definition for Adafruit SAMD09 Breakout with seesaw

class adafruit_seesaw.samd09.SAMD09_Pinmap[source]

This class is automatically used by adafruit_seesaw.seesaw.Seesaw when a SAMD09 Breakout is detected.

It is also a reference for the capabilities of each pin.

analog_pins = (2, 3, 4, 5)

The effective bit resolution of the PWM pins

pwm_pins = (4, 5, 6, 7)

No pins on this board are capable of touch input

pwm_width = 8

The pins capable of PWM output

adafruit_seesaw.tftshield18 - Pin definitions for 1.8” TFT Shield V2

class adafruit_seesaw.tftshield18.Buttons(right, down, left, up, select, a, b, c)
static __new__(_cls, right, down, left, up, select, a, b, c)

Create new instance of Buttons(right, down, left, up, select, a, b, c)

__repr__()

Return a nicely formatted representation string

a

Alias for field number 5

b

Alias for field number 6

c

Alias for field number 7

down

Alias for field number 1

left

Alias for field number 2

right

Alias for field number 0

select

Alias for field number 4

up

Alias for field number 3

class adafruit_seesaw.tftshield18.TFTShield18(i2c_bus=None, addr=46)[source]
buttons

Return a set of buttons with current push values

set_backlight(value)[source]

Set the backlight on

set_backlight_freq(freq)[source]

Set the backlight frequency of the TFT Display

tft_reset(rst=True)[source]

Reset the TFT Display