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, reset=True)[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

  • reset (bool) – Whether to do a software reset on init

sw_reset(post_reset_delay=0.5)[source]

Trigger a software reset of the SeeSaw chip

get_options()[source]

Retrieve the ‘options’ word from the SeeSaw board

get_version()[source]

Retrieve the ‘version’ word from the SeeSaw board

pin_mode(pin, mode)[source]

Set the mode of a pin by number

digital_write(pin, value)[source]

Set the value of an output pin 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

set_GPIO_interrupts(pins, enabled)[source]

Enable or disable the GPIO interrupt

get_GPIO_interrupt_flag(delay=0.008)[source]

Read and clear GPIO interrupts that have fired

analog_read(pin, delay=0.008)[source]

Read the value of an analog pin by number

touch_read(pin)[source]

Read the value of a touch pin by number

moisture_read()[source]

Read the value of the moisture sensor

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

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

analog_write(pin, value)[source]

Set the value of an analog output by number

get_temp()[source]

Read the temperature

set_pwm_freq(pin, freq)[source]

Set the PWM frequency of a pin by number

encoder_position(encoder=0)[source]

The current position of the encoder

set_encoder_position(pos, encoder=0)[source]

Set the current position of the encoder

encoder_delta(encoder=0)[source]

The change in encoder position since it was last read

enable_encoder_interrupt(encoder=0)[source]

Enable the interrupt to fire when the encoder changes position

disable_encoder_interrupt(encoder=0)[source]

Disable the interrupt from firing when the encoder changes

set_i2c_addr(addr)[source]

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

get_i2c_addr()[source]

Return the device’s I2C address stored in its EEPROM

eeprom_write8(addr, val)[source]

Write a single byte directly to the device’s EEPROM

eeprom_write(addr, buf)[source]

Write multiple bytes directly to the device’s EEPROM

eeprom_read8(addr)[source]

Read a single byte directly to the device’s EEPROM

uart_set_baud(baud)[source]

Set the serial baudrate of the device

write8(reg_base, reg, value)[source]

Write an arbitrary I2C byte register on the device

read8(reg_base, reg)[source]

Read an arbitrary I2C byte register on the device

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

Read an arbitrary I2C register range on the device

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

Write an arbitrary I2C register range on the device

adafruit_seesaw.crickit - Pin definition for Adafruit CRICKIT

adafruit_seesaw.analoginput

class adafruit_seesaw.analoginput.AnalogInput(seesaw, pin, delay=0.008)[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

property value

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

property reference_voltage

The reference voltage for the pin

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

switch_to_output(value=False, drive_mode=digitalio.DriveMode.PUSH_PULL)[source]

Switch the pin to output mode

switch_to_input(pull=None)[source]

Switch the pin to input mode

property direction

Retrieve or set the direction of the pin

property value

Retrieve or set the value of the pin

property drive_mode

Retrieve or set the drive mode of an output pin

property pull

Retrieve or set the pull mode of an input 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_HIGH = 0

Indicates that the key is currently pressed

EDGE_LOW = 1

Indicates that the key is currently released

EDGE_FALLING = 2

Indicates that the key was recently pressed

EDGE_RISING = 3

Indicates that the key was recently released

property interrupt_enabled

Retrieve or set the interrupt enable flag

property count

Retrieve or set the number of keys

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

read_keypad(num)[source]

Read data from the keypad

Parameters:

num (int) – The number of bytes to read

adafruit_seesaw.neopixel

adafruit_seesaw.neopixel.RGB = 'RGB'

Red Green Blue

adafruit_seesaw.neopixel.GRB = 'GRB'

Green Red Blue

adafruit_seesaw.neopixel.RGBW = 'RGBW'

Red Green Blue White

adafruit_seesaw.neopixel.GRBW = 'GRBW'

Green Red Blue White

class adafruit_seesaw.neopixel.NeoPixel(*args: Any, **kwargs: Any)[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.

adafruit_seesaw.pwmout

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

A single seesaw channel that matches the PWMOut API.

property frequency

The overall PWM frequency in Hertz.

property 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.

property fraction

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

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_width = 16

The effective bit resolution of the PWM pins

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

The pins capable of PWM output

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.

property 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_width = 8

The pins capable of PWM output

pwm_pins = (4, 5, 6, 7)

No pins on this board are capable of touch input

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

class adafruit_seesaw.tftshield18.Buttons(right, down, left, up, select, a, b, c)
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]
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

property buttons

Return a set of buttons with current push values