expand9 2.0.0.0
Expand 9 Click Driver

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

Topics

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

Functions

void expand9_cfg_setup (expand9_cfg_t *cfg)
 Expand 9 configuration object setup function.
 
err_t expand9_init (expand9_t *ctx, expand9_cfg_t *cfg)
 Expand 9 initialization function.
 
err_t expand9_default_cfg (expand9_t *ctx)
 Expand 9 default configuration function.
 
err_t expand9_set_slave_address (expand9_t *ctx, uint8_t slave_addr)
 Expand 9 set I2C Slave address function.
 
err_t expand9_generic_write (expand9_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Expand 9 I2C writing function.
 
err_t expand9_generic_read (expand9_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Expand 9 I2C reading function.
 
err_t expand9_soft_reset (expand9_t *ctx)
 Expand 9 software reset function.
 
err_t expand9_set_ch_direction (expand9_t *ctx, uint8_t ch_pos, expand9_direction_value_t direction)
 Expand 9 set channel direction function.
 
err_t expand9_set_all_ch_output (expand9_t *ctx)
 Expand 9 set all channel output function.
 
err_t expand9_set_all_ch_input (expand9_t *ctx)
 Expand 9 set all channel input function.
 
err_t expand9_set_ch_output_state (expand9_t *ctx, uint8_t ch_pos, expand9_ch_state_value_t ch_state)
 Expand 9 set channel output state function.
 
err_t expand9_get_ch_output_state (expand9_t *ctx, uint8_t ch_pos, expand9_ch_state_value_t *ch_state)
 Expand 9 get channel output state function.
 
err_t expand9_write_ch (expand9_t *ctx, uint8_t ch_pos, expand9_ch_state_value_t ch_state)
 Expand 9 write channel function.
 
err_t expand9_read_ch (expand9_t *ctx, uint8_t ch_pos, expand9_ch_state_value_t *ch_state)
 Expand 9 read channel function.
 
err_t expand9_led_driver_config (expand9_t *ctx, uint8_t ch_pos, uint8_t freq_div, uint8_t lin_log)
 Expand 9 LED driver configuration function.
 
err_t expand9_set_intensity (expand9_t *ctx, uint8_t ch_pos, uint8_t intensity)
 Expand 9 set intensity function.
 
err_t expand9_sync (expand9_t *ctx)
 Expand 9 sync function.
 
err_t expand9_debounce_config (expand9_t *ctx, uint8_t config_val)
 Expand 9 sync function.
 
err_t expand9_enable_ch_interrupt (expand9_t *ctx, uint8_t ch_pos, uint8_t rise_fall)
 Expand 9 enable channel interrupt function.
 
err_t expand9_clear_interrupt (expand9_t *ctx)
 Expand 9 clear all interrupt function.
 
err_t expand9_check_ch_interrupt (expand9_t *ctx, uint8_t ch_pos, expand9_ch_state_value_t *int_state)
 Expand 9 check channel interrupt function.
 
uint8_t expand9_check_interrupt_pin (expand9_t *ctx)
 Expand 9 check interrupt pin function.
 

Detailed Description

API for configuring and manipulating Expand 9 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

◆ expand9_cfg_setup()

void expand9_cfg_setup ( expand9_cfg_t * cfg)

Expand 9 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ expand9_check_ch_interrupt()

err_t expand9_check_ch_interrupt ( expand9_t * ctx,
uint8_t ch_pos,
expand9_ch_state_value_t * int_state )

Expand 9 check channel interrupt function.

This function check interrupt for desired channels of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[out]ch_pos: Desired channel position [ 0 - 15 ].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_check_interrupt_pin()

uint8_t expand9_check_interrupt_pin ( expand9_t * ctx)

Expand 9 check interrupt pin function.

This function check interrupt pi state of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
Returns
  • 0 - INT pin state low,
  • 1 - INT pin state high.
Note
None.

◆ expand9_clear_interrupt()

err_t expand9_clear_interrupt ( expand9_t * ctx)

Expand 9 clear all interrupt function.

This function clear all interrupts of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

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

◆ expand9_debounce_config()

err_t expand9_debounce_config ( expand9_t * ctx,
uint8_t config_val )

Expand 9 sync function.

This function resets the PWM/Blink/Fade counters, syncing any blinking LEDs of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]config_val: configuring the debounce time:
  • 0 - 0.5 ms * 1/clk,
  • 1 - 1 ms * 1/clk,
  • 2 - 2 ms * 1/clk,
  • 3 - 3 ms * 1/clk,
  • 4 - 8 ms * 1/clk,
  • 5 - 16 ms * 1/clk,
  • 6 - 32 ms * 1/clk,
  • 7 - 64 ms * 1/clk.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_default_cfg()

err_t expand9_default_cfg ( expand9_t * ctx)

Expand 9 default configuration function.

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

Parameters
[in]ctx: Click context object. See expand9_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.

◆ expand9_enable_ch_interrupt()

err_t expand9_enable_ch_interrupt ( expand9_t * ctx,
uint8_t ch_pos,
uint8_t rise_fall )

Expand 9 enable channel interrupt function.

This function enable interrupt for desired channels of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]ch_pos: Desired channel position [ 0 - 15 ].
[in]rise_fall: Interrupt mode:
  • 0x01 ( EXPAND9_CHANGE ) - Both,
  • 0x02 ( EXPAND9_FALLING ) - Falling,
  • 0x03 ( EXPAND9_RISING ) - Rising.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_generic_read()

err_t expand9_generic_read ( expand9_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Expand 9 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 expand9_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.

◆ expand9_generic_write()

err_t expand9_generic_write ( expand9_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Expand 9 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 expand9_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.

◆ expand9_get_ch_output_state()

err_t expand9_get_ch_output_state ( expand9_t * ctx,
uint8_t ch_pos,
expand9_ch_state_value_t * ch_state )

Expand 9 get channel output state function.

This function get output state of the desired channel of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]ch_pos: Desired channel position [ 0 - 15 ].
[out]ch_state: Channel state object data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_init()

err_t expand9_init ( expand9_t * ctx,
expand9_cfg_t * cfg )

Expand 9 initialization function.

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

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

◆ expand9_led_driver_config()

err_t expand9_led_driver_config ( expand9_t * ctx,
uint8_t ch_pos,
uint8_t freq_div,
uint8_t lin_log )

Expand 9 LED driver configuration function.

This function rinitializes LED driving on a channel. It must be called if you want to use the pwm or blink functions on that channel of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]ch_pos: Desired channel position [ 0 - 15 ].
[in]freq_div: LED clock frequency divider.
[in]lin_log: selects either linear or logarithmic mode on the LED drivers:
  • 0 - Linear mode,
  • 1 - Logarithmic mode.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_read_ch()

err_t expand9_read_ch ( expand9_t * ctx,
uint8_t ch_pos,
expand9_ch_state_value_t * ch_state )

Expand 9 read channel function.

This function reads the input channel state ( high or low ) of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]ch_pos: Desired channel position [ 0 - 15 ].
[out]ch_state: Channel state object data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_set_all_ch_input()

err_t expand9_set_all_ch_input ( expand9_t * ctx)

Expand 9 set all channel input function.

This function sets input direction for all channels of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

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

◆ expand9_set_all_ch_output()

err_t expand9_set_all_ch_output ( expand9_t * ctx)

Expand 9 set all channel output function.

This function sets output direction for all channels of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

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

◆ expand9_set_ch_direction()

err_t expand9_set_ch_direction ( expand9_t * ctx,
uint8_t ch_pos,
expand9_direction_value_t direction )

Expand 9 set channel direction function.

This function sets desired direction of the desired channel of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]direction: Direction object data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_set_ch_output_state()

err_t expand9_set_ch_output_state ( expand9_t * ctx,
uint8_t ch_pos,
expand9_ch_state_value_t ch_state )

Expand 9 set channel output state function.

This function sets output state of the desired channel of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]ch_pos: Desired channel position [ 0 - 15 ].
[in]ch_state: Channel state object data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_set_intensity()

err_t expand9_set_intensity ( expand9_t * ctx,
uint8_t ch_pos,
uint8_t intensity )

Expand 9 set intensity function.

This function can be used to control the intensity of an output channel connected to an LED of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]ch_pos: Desired channel position [ 0 - 15 ].
[in]intensity: Intensity of the LED.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ expand9_set_slave_address()

err_t expand9_set_slave_address ( expand9_t * ctx,
uint8_t slave_addr )

Expand 9 set I2C Slave address function.

This function sets I2C address of the subordinate I2C device to address which is targeted by read and write operations.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]slave_addr: Specified I2C slave 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
It is recommended to check return value for error.

◆ expand9_soft_reset()

err_t expand9_soft_reset ( expand9_t * ctx)

Expand 9 software reset function.

This function performs software reset of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

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

◆ expand9_sync()

err_t expand9_sync ( expand9_t * ctx)

Expand 9 sync function.

This function resets the PWM/Blink/Fade counters, syncing any blinking LEDs of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

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

◆ expand9_write_ch()

err_t expand9_write_ch ( expand9_t * ctx,
uint8_t ch_pos,
expand9_ch_state_value_t ch_state )

Expand 9 write channel function.

This function writes a channel to either high or low if it's configured as an output. If the channel is configured as an input, this method will activate either the pull-up or pull-down resistor ( high or low respectively ) of the SX1509QB, World’s Lowest Voltage Level Shifting GPIO with LED Driver and Keypad Engine on the Expand 9 click board™.

Parameters
[in]ctx: Click context object. See expand9_t object definition for detailed explanation.
[in]ch_pos: Desired channel position [ 0 - 15 ].
[in]ch_state: Channel state object data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.