capslider3 2.2.0
Loading...
Searching...
No Matches
capslider3


Cap Slider 3 Click

Cap Slider 3 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 : I2C type

Software Support

Example Description

This example demonstrates the use of the Cap Slider 3 Click board by initializing the device and reading the current slider position. The application logs the detected slider position in real-time.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.CapSlider3

Example Key Functions

Application Init

Initializes the logger and the Cap Slider 3 Click driver.

void application_init ( void )
{
log_cfg_t log_cfg;
capslider3_cfg_t capslider3_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
capslider3_cfg_setup( &capslider3_cfg );
CAPSLIDER3_MAP_MIKROBUS( capslider3_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == capslider3_init( &capslider3, &capslider3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( CAPSLIDER3_ERROR == capslider3_default_cfg ( &capslider3 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ CAPSLIDER3_ERROR
Definition capslider3.h:445
#define CAPSLIDER3_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition capslider3.h:379
void application_init(void)
Definition main.c:49

Application Task

Continuously reads and logs the slider position detected by the Cap Slider 3 Click board.

void application_task ( void )
{
if ( CAPSLIDER3_OK == capslider3_read_data ( &capslider3, &sys_info ) )
{
if ( CAPSLIDER3_SLIDER_IDLE != sys_info.slider )
{
log_printf ( &logger, " Slider: - %u -\r\n\n", sys_info.slider );
}
}
}
@ CAPSLIDER3_OK
Definition capslider3.h:444
#define CAPSLIDER3_SLIDER_IDLE
Definition capslider3.h:262
void application_task(void)
Definition main.c:85
uint16_t slider
Definition capslider3.h:395

Note

Functions for logging gestures and statuses are available but not used in this example.

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.