expand9  2.0.0.0
Main Page

Expand 9 Click

Expand 9 Click is a compact add-on board that contains a multi-port I/O expander. This board features the SX1509QB, the world’s lowest voltage level shifting GPIO expander from Semtech Corporation. The SX1509QB comes in a 16-channel configuration and allows easy serial expansion of I/O through a standard I2C serial interface. It also has a built-in level shifting feature making it highly flexible in power supply systems where communication between incompatible I/O voltages is required, an integrated LED driver for enhanced lighting, and a keypad scanning engine to implement keypad applications up to 8x8 matrix.

Click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Aug 2021.
  • Type : I2C type

Software Support

We provide a library for the Expand9 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Expand9 Click driver.

Standard key functions :

Example key functions :

Example Description

This is an example that demonstrates the use of the Expand 9 Click board™. The library initializes and defines the I2C bus drivers to write and read data from registers.

The demo application is composed of two sections :

Application Init

The initialization of I2C module, log UART, and additional pins. After driver initialization the app set default settings.

void application_init ( void )
{
log_cfg_t log_cfg;
expand9_cfg_t expand9_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
expand9_cfg_setup( &expand9_cfg );
EXPAND9_MAP_MIKROBUS( expand9_cfg, MIKROBUS_1 );
err_t init_flag = expand9_init( &expand9, &expand9_cfg );
if ( I2C_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
expand9_default_cfg ( &expand9 );
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
}

Application Task

his is an example that demonstrates the use of the Expand 9 Click board™. This example shows the capabilities of the Expand 9 Click by toggling each of 16 available channels. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void )
{
expand9_soft_reset( &expand9 );
Delay_ms ( 100 );
for ( uint8_t cnt = 0; cnt < 16; cnt++ )
{
Delay_ms ( 100 );
Delay_ms ( 100 );
}
for ( uint8_t cnt = 15; cnt > 0; cnt-- )
{
Delay_ms ( 100 );
Delay_ms ( 100 );
}
expand9_soft_reset( &expand9 );
Delay_ms ( 100 );
for ( uint8_t cnt = 0; cnt < 16; cnt++ )
{
expand9_set_intensity( &expand9, cnt, 10 );
Delay_ms ( 100 );
expand9_set_intensity( &expand9, cnt, 200 );
Delay_ms ( 100 );
}
for ( uint8_t cnt = 15; cnt > 0; cnt-- )
{
expand9_set_intensity( &expand9, cnt, 200 );
Delay_ms ( 100 );
expand9_set_intensity( &expand9, cnt, 10 );
Delay_ms ( 100 );
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Expand9

Additional notes and informations

Depending on the development board you are using, you may need USB UART Click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


expand9_cfg_t
Expand 9 Click configuration object.
Definition: expand9.h:274
expand9_cfg_setup
void expand9_cfg_setup(expand9_cfg_t *cfg)
Expand 9 configuration object setup function.
expand9_set_intensity
err_t expand9_set_intensity(expand9_t *ctx, uint8_t ch_pos, uint8_t intensity)
Expand 9 set intensity function.
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.
EXPAND9_LED_MODE_LINEAR
#define EXPAND9_LED_MODE_LINEAR
Definition: expand9.h:210
expand9_t
Expand 9 Click context object.
Definition: expand9.h:252
EXPAND9_MAP_MIKROBUS
#define EXPAND9_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: expand9.h:237
application_task
void application_task(void)
Definition: main.c:67
expand9_ch_state_value_t
expand9_ch_state_value_t
Expand 9 Click channel state value data.
Definition: expand9.h:314
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.
EXPAND9_FREQ_DIV_1
#define EXPAND9_FREQ_DIV_1
Definition: expand9.h:203
expand9_default_cfg
err_t expand9_default_cfg(expand9_t *ctx)
Expand 9 default configuration function.
expand9_soft_reset
err_t expand9_soft_reset(expand9_t *ctx)
Expand 9 software reset function.
expand9_init
err_t expand9_init(expand9_t *ctx, expand9_cfg_t *cfg)
Expand 9 initialization function.
CH_OUTPUT_ON
@ CH_OUTPUT_ON
Definition: expand9.h:316
application_init
void application_init(void)
Definition: main.c:32
CH_OUTPUT_OFF
@ CH_OUTPUT_OFF
Definition: expand9.h:315