PCA9536

Driver for PCA9536 4-bit I2C IO pin expander.

Protected Attributes

Type

Name

I2C

Public Functions

Type

Name

PCA9536 (PinName sda, PinName scl)

int

set_output (uint8_t pin)

int

set_input (uint8_t pin)

int

set_value (uint8_t value)

int

set_value (uint8_t pin, uint8_t value)

int

get_value (uint8_t * value)

int

get_value (uint8_t pin, uint8_t * value)

Protected Functions

Type

Name

int

_write_reg (uint8_t reg, uint8_t val)

int

_read_reg (uint8_t reg, uint8_t * val)

Protected Attributes Documentation

variable _i2c

I2C PCA9536::_i2c;

Public Functions Documentation

function PCA9536

PCA9536::PCA9536 (
    PinName sda,
    PinName scl
)

int PCA9536::set_all_inputs ()

Set port as input.

Returns:

0 on success; non-0 on fail

int PCA9536::set_all_outputs ()

Set port as output.

Returns:

0 on success; non-0 on fail

function set_output

int PCA9536::set_output (
    uint8_t pin
)

Set pin as output.

Parameters:

  • pin pin number to set as output (0 - 3)

Returns:

0 on success; -2 on invalid pin; non-0 on fail

function set_input

int PCA9536::set_input (
    uint8_t pin
)

Set pin as input.

Parameters:

  • pin pin number to set (0 - 3)

Returns:

0 on success; -2 on invalid pin; non-0 on fail

function set_value

int PCA9536::set_value (
    uint8_t value
)

Set port value.

Parameters:

  • value value to set on port (0 - F)

Returns:

0 on success; non-0 on fail

function set_value

int PCA9536::set_value (
    uint8_t pin,
    uint8_t value
)

Set pin value.

Parameters:

  • pin pin number to set (0 - 3)

  • pin value to set (0 or 1)

Returns:

0 on success; -2 on invalid pin; non-0 on fail

function get_value

int PCA9536::get_value (
    uint8_t * value
)

Get port value.

Parameters:

  • value pointer to byte to read the value in to

Returns:

0 on success; non-0 on fail

function get_value

int PCA9536::get_value (
    uint8_t pin,
    uint8_t * value
)

Get pin value.

Parameters:

  • pin pin to read

  • value pointer to byte to read the value in to

Returns:

0 on success; -2 on invalid pin; non-0 on fail

Protected Functions Documentation

function _write_reg

int PCA9536::_write_reg (
    uint8_t reg,
    uint8_t val
)

function _read_reg

int PCA9536::_read_reg (
    uint8_t reg,
    uint8_t * val
)

The documentation for this class was generated from the following file: D:/w/hw-libs/\_libs\_/libraries/PCA9536.h

Last updated