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
- solidswitch9_cfg_setup This function initializes Click configuration structure to initial values.
void solidswitch9_cfg_setup(solidswitch9_cfg_t *cfg)
SolidSwitch 9 configuration object setup function.
SolidSwitch 9 Click configuration object.
Definition solidswitch9.h:404
- solidswitch9_init This function initializes all necessary pins and peripherals used for this Click board.
err_t solidswitch9_init(solidswitch9_t *ctx, solidswitch9_cfg_t *cfg)
SolidSwitch 9 initialization function.
SolidSwitch 9 Click context object.
Definition solidswitch9.h:383
- solidswitch9_default_cfg This function executes a default configuration of SolidSwitch 9 Click board.
err_t solidswitch9_default_cfg(solidswitch9_t *ctx)
SolidSwitch 9 default configuration function.
- solidswitch9_set_out_duty This function sets the output duty cycle for the selected output channels.
err_t solidswitch9_set_out_duty(solidswitch9_t *ctx, uint8_t out_mask, uint16_t duty)
SolidSwitch 9 set output duty function.
- solidswitch9_enable_out This function enables the selected outputs.
err_t solidswitch9_enable_out(solidswitch9_t *ctx, uint8_t out_mask)
SolidSwitch 9 enable outputs function.
- solidswitch9_clear_all_status This function clears all status registers on the SolidSwitch 9 Click board.
err_t solidswitch9_clear_all_status(solidswitch9_t *ctx)
SolidSwitch 9 clear all status function.
Application Init
Initializes the logger and the Click board driver, and applies the default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
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.
{
static int8_t duty_inc = 1;
if ( out_ch_old != out_ch )
{
log_printf ( &logger, "\r\n Active channel: " );
{
log_printf ( &logger, "3\r\n" );
}
else
{
log_printf ( &logger, "%u\r\n", ( uint16_t ) ( out_ch >> 1 ) );
}
out_ch_old = out_ch;
}
duty += duty_inc;
{
{
out_ch <<= 1;
{
}
}
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.