expand12 2.0.0.0
Expand 12 Click Driver

API for configuring and manipulating Expand 12 Click driver. More...

Topics

 Expand 12 Registers List
 List of registers of Expand 12 Click driver.
 
 Expand 12 Registers Settings
 Settings for registers of Expand 12 Click driver.
 
 Expand 12 MikroBUS Map
 MikroBUS pin mapping of Expand 12 Click driver.
 

Functions

void expand12_cfg_setup (expand12_cfg_t *cfg)
 Expand 12 configuration object setup function.
 
err_t expand12_init (expand12_t *ctx, expand12_cfg_t *cfg)
 Expand 12 initialization function.
 
err_t expand12_default_cfg (expand12_t *ctx)
 Expand 12 default configuration function.
 
err_t expand12_generic_write (expand12_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Expand 12 I2C writing function.
 
err_t expand12_generic_read (expand12_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Expand 12 I2C reading function.
 
err_t expand12_write_register (expand12_t *ctx, uint8_t reg, uint8_t data_in)
 Expand 12 write register function.
 
err_t expand12_read_register (expand12_t *ctx, uint8_t reg, uint8_t *data_out)
 Expand 12 read register function.
 
err_t expand12_set_operating_mode (expand12_t *ctx, uint8_t state)
 Expand 12 set operating mode function.
 
err_t expand12_set_pin_direction (expand12_t *ctx, uint8_t pin, uint8_t direction)
 Expand 12 set pin direction function.
 
err_t expand12_set_port_direction (expand12_t *ctx, uint8_t port, uint8_t direction)
 Expand 12 set port direction function.
 
err_t expand12_set_all_pins_direction (expand12_t *ctx, uint8_t direction)
 Expand 12 set all pins direction function.
 
err_t expand12_set_pin_value (expand12_t *ctx, uint8_t pin, uint8_t pin_value)
 Expand 12 set pin value function.
 
err_t expand12_set_port_value (expand12_t *ctx, uint8_t port, uint8_t clr_mask, uint8_t set_mask)
 Expand 12 set port value function.
 
err_t expand12_set_all_pins_value (expand12_t *ctx, uint8_t pin_value)
 Expand 12 set all pins value function.
 
err_t expand12_read_pin_value (expand12_t *ctx, uint8_t pin, uint8_t *pin_value)
 Expand 12 read pin value function.
 
err_t expand12_read_port_value (expand12_t *ctx, uint8_t port, uint8_t *port_value)
 Expand 12 read port value function.
 
err_t expand12_read_all_pins_value (expand12_t *ctx, uint32_t *pins_value)
 Expand 12 read all pins value function.
 

Detailed Description

API for configuring and manipulating Expand 12 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ expand12_cfg_setup()

void expand12_cfg_setup ( expand12_cfg_t * cfg)

Expand 12 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See expand12_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ expand12_default_cfg()

err_t expand12_default_cfg ( expand12_t * ctx)

Expand 12 default configuration function.

This function executes a default configuration of Expand 12 click board.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ expand12_generic_read()

err_t expand12_generic_read ( expand12_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Expand 12 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_generic_write()

err_t expand12_generic_write ( expand12_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Expand 12 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_init()

err_t expand12_init ( expand12_t * ctx,
expand12_cfg_t * cfg )

Expand 12 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See expand12_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_read_all_pins_value()

err_t expand12_read_all_pins_value ( expand12_t * ctx,
uint32_t * pins_value )

Expand 12 read all pins value function.

This function reads all pins logic levels.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[out]pins_value: All pins value (32-bit).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_read_pin_value()

err_t expand12_read_pin_value ( expand12_t * ctx,
uint8_t pin,
uint8_t * pin_value )

Expand 12 read pin value function.

This function reads the logic level of the selected pin.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]pin: Pin selection value [0,27].
[out]pin_value:
  • 0 - Low,
  • 1 - High.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_read_port_value()

err_t expand12_read_port_value ( expand12_t * ctx,
uint8_t port,
uint8_t * port_value )

Expand 12 read port value function.

This function reads the pins logic level of the selected port.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]port:
  • 0 - Port 4-7,
  • 1 - Port 8-15,
  • 2 - Port 16-23,
  • 3 - Port 24-31.
[out]port_value: Port value (8-bit).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_read_register()

err_t expand12_read_register ( expand12_t * ctx,
uint8_t reg,
uint8_t * data_out )

Expand 12 read register function.

This function reads a data byte from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output data read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_set_all_pins_direction()

err_t expand12_set_all_pins_direction ( expand12_t * ctx,
uint8_t direction )

Expand 12 set all pins direction function.

This function sets the direction of all pins.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]direction:
  • 1 - Output,
  • 2 - Input,
  • 3 - Input with pullup.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_set_all_pins_value()

err_t expand12_set_all_pins_value ( expand12_t * ctx,
uint8_t pin_value )

Expand 12 set all pins value function.

This function sets the logic level of all output pins.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]pin_value:
  • 0 - Low,
  • 1 - High.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_set_operating_mode()

err_t expand12_set_operating_mode ( expand12_t * ctx,
uint8_t state )

Expand 12 set operating mode function.

This function sets a device operating mode.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]state:
  • 0 - Shutdown,
  • 1 - Normal operating mode.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_set_pin_direction()

err_t expand12_set_pin_direction ( expand12_t * ctx,
uint8_t pin,
uint8_t direction )

Expand 12 set pin direction function.

This function sets the direction of the selected pin.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]pin: Pin selection value [0,27].
[in]direction:
  • 1 - Output,
  • 2 - Input,
  • 3 - Input with pullup.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_set_pin_value()

err_t expand12_set_pin_value ( expand12_t * ctx,
uint8_t pin,
uint8_t pin_value )

Expand 12 set pin value function.

This function sets the logic level of the selected pin.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]pin: Pin selection value [0,27].
[in]pin_value:
  • 0 - Low,
  • 1 - High.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_set_port_direction()

err_t expand12_set_port_direction ( expand12_t * ctx,
uint8_t port,
uint8_t direction )

Expand 12 set port direction function.

This function sets the direction of the selected port.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]port:
  • 0 - Port 4-7,
  • 1 - Port 8-15,
  • 2 - Port 16-23,
  • 3 - Port 24-31.
[in]direction:
  • 1 - Output,
  • 2 - Input,
  • 3 - Input with pullup.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_set_port_value()

err_t expand12_set_port_value ( expand12_t * ctx,
uint8_t port,
uint8_t clr_mask,
uint8_t set_mask )

Expand 12 set port value function.

This function sets the pins level value of the selected port.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]port:
  • 0 - Port 4-7,
  • 1 - Port 8-15,
  • 2 - Port 16-23,
  • 3 - Port 24-31.
[in]clr_mask: Pin clear mask.
[in]set_mask: Pin set mask.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand12_write_register()

err_t expand12_write_register ( expand12_t * ctx,
uint8_t reg,
uint8_t data_in )

Expand 12 write register function.

This function writes a desired data byte to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See expand12_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.