solidswitch 2.0.0.0
Main Page

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 :

Example key functions :

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.

void application_init ( void )
{
log_cfg_t log_cfg;
solidswitch_cfg_t solidswitch_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
solidswitch_cfg_setup( &solidswitch_cfg );
SOLIDSWITCH_MAP_MIKROBUS( solidswitch_cfg, MIKROBUS_1 );
err_t init_flag = solidswitch_init( &solidswitch, &solidswitch_cfg );
if ( init_flag == I2C_MASTER_ERROR )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
solidswitch_default_cfg ( &solidswitch );
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.

void application_task ( void )
{
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.