Expand 8 click
Expand 8 Click is a compact add-on board that contains a multi-port I/O expander with bi-directional input/outputs. This board features the MAX7317, 10-Port SPI-interfaced I/O expander with overvoltage and hot-insertion protection from Maxim Integrated.
click Product page
Click library
- Author : Stefan Ilic
- Date : Oct 2021.
- Type : SPI type
Software Support
We provide a library for the Expand8 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 Expand8 Click driver.
Standard key functions :
expand8_cfg_setup
Config Object Initialization function.
void expand8_cfg_setup(expand8_cfg_t *cfg)
Expand 8 configuration object setup function.
Expand 8 Click configuration object.
Definition expand8.h:161
expand8_init
Initialization function.
err_t expand8_init(expand8_t *ctx, expand8_cfg_t *cfg)
Expand 8 initialization function.
Expand 8 Click context object.
Definition expand8.h:148
Example key functions :
expand8_write_data
Generic write data function.
void expand8_write_data(expand8_t *ctx, uint8_t addr, uint8_t tx_data)
Generic write data function.
expand8_read_data
Generic read data function.
uint8_t expand8_read_data(expand8_t *ctx, uint8_t addr)
Generic read data function.
expand8_set_port
Set port function.
err_t expand8_set_port(expand8_t *ctx, uint8_t sel_port, uint8_t sel_imped)
Set port function.
Example Description
This is an example that demonstrates the use of the Expand 8 click board.
The demo application is composed of two sections :
Application Init
Initialization driver enables - SPI, also write log.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( SPI_MASTER_ERROR == init_flag ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
}
#define EXPAND8_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition expand8.h:134
#define EXPAND8_ADDR_OUT_LVL_PORT_P0
Expand 8 port adresses.
Definition expand8.h:74
void application_init(void)
Definition main.c:29
uint8_t select_port
Definition main.c:27
Application Task
This example is working by toggling each of 10 available ports every 1 second. Results are being sent to the Uart Terminal where you can track their changes.
{
log_printf( &logger,
" Port P%d - ON\r\n", ( uint16_t )
select_port );
log_printf( &logger, "- - - - - - - - - - -\r\n" );
Delay_ms ( 1000 );
log_printf( &logger,
" Port P%d - OFF\r\n", ( uint16_t )
select_port );
log_printf( &logger, "---------------------\r\n" );
Delay_ms ( 1000 );
}
}
#define EXPAND8_ADDR_OUT_LVL_PORT_P9
Definition expand8.h:83
#define EXPAND8_SET_LOW_IMPEDANCE
Expand 8 impedance set values.
Definition expand8.h:97
#define EXPAND8_SET_HIGH_IMPEDANCE
Definition expand8.h:98
void application_task(void)
Definition main.c:64
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.Expand8
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.