currentlimit5 2.2.0
Loading...
Searching...
No Matches
currentlimit5


Current Limit 5 Click

Current Limit 5 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 : Jan 2022.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of Current Limit 5 Click board by limiting the current to a certain value and displaying an appropriate message when the current reaches the limit.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.CurrentLimit5

Example Key Functions

Application Init

Initializes the driver and performs the Click default configuration which sets the current limit to 200mA.

void application_init ( void )
{
log_cfg_t log_cfg;
currentlimit5_cfg_t currentlimit5_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
currentlimit5_cfg_setup( &currentlimit5_cfg );
CURRENTLIMIT5_MAP_MIKROBUS( currentlimit5_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == currentlimit5_init( &currentlimit5, &currentlimit5_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( CURRENTLIMIT5_ERROR == currentlimit5_default_cfg ( &currentlimit5 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ CURRENTLIMIT5_ERROR
Definition currentlimit5.h:154
#define CURRENTLIMIT5_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition currentlimit5.h:101
err_t currentlimit5_default_cfg(currentlimit5_t *ctx)
Current Limit 5 default configuration function.
void application_init(void)
Definition main.c:30

Application Task

Displays the fault indicator state on the USB UART.

void application_task ( void )
{
static uint8_t currentlimit_ind = 2;
if ( currentlimit5_get_fault_pin ( &currentlimit5 ) )
{
if ( currentlimit_ind != 0 )
{
log_printf ( &logger, " The switch is in normal operation \r\n\n" );
currentlimit_ind = 0;
}
}
else
{
if ( currentlimit_ind != 1 )
{
log_printf ( &logger, " The switch is in the current limiting or thermal shutdown operation \r\n\n" );
currentlimit_ind = 1;
}
}
}
void application_task(void)
Definition main.c:66

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.