Skip to content

SX1503 Module

This module contains the Zerynth driver for Semtech SX1503 low voltage General Purpose parallel Input/Output. The unit allows easy serial expansion of I/O through a standard 400kHz I2C interface. Interrupt handling and programmable logic functions are not implemented (datasheet).

SX1503 class

class SX1503(drvname, clk=400000)`

Creates an intance of the SX1503 class.

Arguments:

  • drvname – I2C Bus used ‘( I2C0, … )’
  • clk – Clock speed, default 400kHz

Example:

from semtech.sx1503 import sx1503

...

port_expander = sx1503.SX1503(I2C1)
port_expander.pinMode(10,INPUT_PULLUP)

state = port_expander.digitalRead(10)

port_expander.pinMode(0,OUTPUT)
port_expander.digitalWrite(0,HIGH)
pinMode

pinMode(pin, mode)

Select a mode for a pin. Valid pin values are from 0 to 15 included. Available modes are:

  • INPUT
  • INPUT_PULLUP
  • INPUT_PULLDOWN
  • OUTPUT
get_port

get_port(port)

Returns the state of all pins on port port. As a consequence of having 8 pins for port, returned value can be between 0 and 255.

port I/O bank pins
0 A 0 to 7
1 B 8 to 15
digitalRead

digitalRead(pin)

Returns the state of pin pin. The state can be 0 or 1.

digitalWrite

digitalWrite(pin, val)

Set pin pin to value val. Value can be 0 or 1.

set_port

set_port(port, val)

Set all pins on port port to value val. val MUST be between 0 and 255.

set_boost

set_boost(mode)

Set the boost mode (cfr. par 2.2.1 of the datasheet).

mode boost mode
0 OFF
1 ON
<!--stackedit_data:
eyJoaXN0b3J5IjpbLTgxMDQyNDM0OV19