SolidSwitch click
SolidSwitch Click is a compact add-on board that contains load switch devices. This board features the TPS22918, four single-channel load switches from Texas Instruments.
click Product page
Click library
- Author : Stefan Filipovic
- Date : Feb 2021.
- Type : I2C type
Software Support
We provide a library for the SolidSwitch 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 SolidSwitch Click driver.
Standard key functions :
solidswitch_cfg_setup
Config Object Initialization function.
void solidswitch_cfg_setup(solidswitch_cfg_t *cfg)
SolidSwitch configuration object setup function.
SolidSwitch Click configuration object.
Definition solidswitch.h:144
solidswitch_init
Initialization function.
err_t solidswitch_init(solidswitch_t *ctx, solidswitch_cfg_t *cfg)
SolidSwitch initialization function.
SolidSwitch Click context object.
Definition solidswitch.h:120
solidswitch_default_cfg
Click Default Configuration function.
err_t solidswitch_default_cfg(solidswitch_t *ctx)
SolidSwitch default configuration function.
Example key functions :
solidswitch_write_single
SolidSwitch I2C writing logic state function.
err_t solidswitch_write_single(solidswitch_t *ctx, uint8_t logic_state)
SolidSwitch I2C writing logic state function.
solidswitch_read_single
SolidSwitch I2C reading logic state function.
err_t solidswitch_read_single(solidswitch_t *ctx, uint8_t *logic_state)
SolidSwitch I2C reading logic state function.
solidswitch_reset
SolidSwitch reset function.
void solidswitch_reset(solidswitch_t *ctx)
SolidSwitch reset function.
Example Description
This example demonstrates the use of SolidSwitch click board.
The demo application is composed of two sections :
Application Init
Initializes the driver and logger and enables the click board.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( init_flag == I2C_MASTER_ERROR )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define SOLIDSWITCH_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition solidswitch.h:106
void application_init(void)
Definition main.c:38
Application Task
Enables different outputs every 3 seconds and displays all enabled outputs on USB UART.
{
solidswitch_display_enabled_channels( );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
solidswitch_display_enabled_channels( );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
solidswitch_display_enabled_channels( );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
solidswitch_display_enabled_channels( );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define SOLIDSWITCH_ENABLE_OUT0
Definition solidswitch.h:76
#define SOLIDSWITCH_ENABLE_OUT7
SolidSwitch description setting.
Definition solidswitch.h:73
#define SOLIDSWITCH_DISABLE_ALL_OUTPUTS
Definition solidswitch.h:78
#define SOLIDSWITCH_ENABLE_ALL_OUTPUTS
Definition solidswitch.h:77
#define SOLIDSWITCH_ENABLE_OUT6
Definition solidswitch.h:74
#define SOLIDSWITCH_ENABLE_OUT1
Definition solidswitch.h:75
void application_task(void)
Definition main.c:73
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.SolidSwitch
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.