cooler  2.1.0.0
Main Page

Cooler click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Nenad Filipovic
  • Date : Jan 2024.
  • Type : ADC/I2C type

Software Support

We provide a library for the Cooler 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 Cooler Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of the Cooler click board

by reading the target object temperature and controlling the cooler.

The demo application is composed of two sections :

Application Init

The initialization of the I2C module, log UART, and additional pins.

After the driver init, the app executes a default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
cooler_cfg_t cooler_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
cooler_cfg_setup( &cooler_cfg );
COOLER_MAP_MIKROBUS( cooler_cfg, MIKROBUS_1 );
err_t init_flag = cooler_init( &cooler, &cooler_cfg );
if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( COOLER_ERROR == cooler_default_cfg ( &cooler ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

The demo application measures the temperature of the target object in degrees Celsius

and enables a cooler if the temperature exceeds the temperature high limit value. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
float temperature = 0;
if ( COOLER_OK == cooler_get_object_temperature( &cooler, &temperature ) )
{
log_printf( &logger, " Temperature: %.2f degC\r\n", temperature );
log_printf( &logger, " Cooler: " );
if ( COOLER_TEMP_HIGH_LIMIT < temperature )
{
{
log_printf( &logger, " Enabled.\r\n\n" );
}
}
else
{
{
log_printf( &logger, " Disabled.\r\n\n" );
}
}
}
Delay_ms( 1000 );
}

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.Cooler

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.


cooler_cfg_setup
void cooler_cfg_setup(cooler_cfg_t *cfg)
Cooler configuration object setup function.
COOLER_DISABLE
@ COOLER_DISABLE
Definition: cooler.h:254
COOLER_TEMP_HIGH_LIMIT
#define COOLER_TEMP_HIGH_LIMIT
Definition: main.c:29
cooler_init
err_t cooler_init(cooler_t *ctx, cooler_cfg_t *cfg)
Cooler initialization function.
COOLER_OK
@ COOLER_OK
Definition: cooler.h:242
cooler_set_out_state
err_t cooler_set_out_state(cooler_t *ctx, cooler_out_state_t out_state)
Cooler set output function.
application_task
void application_task(void)
Definition: main.c:71
COOLER_ERROR
@ COOLER_ERROR
Definition: cooler.h:243
COOLER_MAP_MIKROBUS
#define COOLER_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: cooler.h:174
cooler_out_state_t
cooler_out_state_t
Cooler Click cooler states selection.
Definition: cooler.h:252
cooler_get_object_temperature
err_t cooler_get_object_temperature(cooler_t *ctx, float *temperature)
Cooler get object temperature function.
application_init
void application_init(void)
Definition: main.c:34
COOLER_ENABLE
@ COOLER_ENABLE
Definition: cooler.h:253
cooler_cfg_t
Cooler Click configuration object.
Definition: cooler.h:220
cooler_t
Cooler Click context object.
Definition: cooler.h:201
cooler_default_cfg
err_t cooler_default_cfg(cooler_t *ctx)
Cooler default configuration function.