PCA9536 Module¶
This is a Module for the PCA9536 I/O expander by Texas Instruments. The Module implements the PCA9536 as an output device utilizing the OC01 xChip. The board uses I2C for communication.
Data Sheets: PCA9536
PCA9536 class¶
-
class
PCA9536
(self, drvname, addr = 0x41, clk = 100000)¶ Create an instance of the PCA9536 class.
Parameters: - drvname – I2C Bus used ‘( I2C0, ... )’
- addr – Slave address, default 0x41
- clk – Clock speed, default 100kHz
-
init
(self, pins = PCA9536_ALL_OUTPUTS_OFF)¶ Configures PCA9536 and sets all outputs False by default
Parameters: pins – gives the pins an initial state
-
writePin
(self, pin, state)¶ Determines the status of the output
Parameters: - pin – accepts one of four output pins on PCA9536 (1, 2, 4, 8)
- state – accepts the state at which selected pin should be (True or False)
-
getStatus
(self)¶ Reads the status of the output port. To read a single bit/pin mask the return value with the pin number. | Eg. getStatus()& OUT0
returns the status of the output port