solidswitch9 2.2.0
Loading...
Searching...
No Matches
solidswitch9


SolidSwitch 9 Click

SolidSwitch 9 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Apr 2025.
  • Type : SPI type

Software Support

Example Description

This example demonstrates the use of the SolidSwitch 9 Click board by gradually increasing and decreasing the output duty cycle of each output channel one by one. After each update, the output is enabled and the diagnostic status is cleared.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SolidSwitch9

Example Key Functions

Application Init

Initializes the logger and the Click board driver, and applies the default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
solidswitch9_cfg_t solidswitch9_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
solidswitch9_cfg_setup( &solidswitch9_cfg );
SOLIDSWITCH9_MAP_MIKROBUS( solidswitch9_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == solidswitch9_init( &solidswitch9, &solidswitch9_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( SOLIDSWITCH9_ERROR == solidswitch9_default_cfg ( &solidswitch9 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define SOLIDSWITCH9_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition solidswitch9.h:366
void application_init(void)
Definition main.c:31
@ SOLIDSWITCH9_ERROR
Definition solidswitch9.h:431

Application Task

Adjusts the output duty cycle from 0% to 100% and back to 0% for each channel sequentially and clears the diagnostic status after each duty cycle update. The currently active output channel number is logged on the USB UART.

void application_task ( void )
{
static uint8_t out_ch_old = SOLIDSWITCH9_OUT_MASK;
static uint8_t out_ch = SOLIDSWITCH9_OUT1;
static int16_t duty = SOLIDSWITCH9_OUT_DUTY_0_PCT;
static int8_t duty_inc = 1;
if ( out_ch_old != out_ch )
{
log_printf ( &logger, "\r\n Active channel: " );
if ( SOLIDSWITCH9_OUT3 == out_ch )
{
log_printf ( &logger, "3\r\n" );
}
else
{
log_printf ( &logger, "%u\r\n", ( uint16_t ) ( out_ch >> 1 ) );
}
out_ch_old = out_ch;
}
solidswitch9_set_out_duty ( &solidswitch9, out_ch, duty );
solidswitch9_enable_out ( &solidswitch9, out_ch );
solidswitch9_clear_all_status ( &solidswitch9 );
duty += duty_inc;
{
{
out_ch <<= 1;
if ( out_ch > SOLIDSWITCH9_OUT3 )
{
}
}
duty_inc *= -1;
duty += duty_inc;
}
}
#define SOLIDSWITCH9_OUT_DUTY_100_PCT
Definition solidswitch9.h:330
#define SOLIDSWITCH9_OUT_DUTY_0_PCT
Definition solidswitch9.h:310
#define SOLIDSWITCH9_OUT3
SolidSwitch 9 output setting.
Definition solidswitch9.h:305
#define SOLIDSWITCH9_OUT_MASK
Definition solidswitch9.h:309
#define SOLIDSWITCH9_OUT0
Definition solidswitch9.h:308
#define SOLIDSWITCH9_OUT1
Definition solidswitch9.h:307
void application_task(void)
Definition main.c:67

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.