bargraph5  2.1.0.0
Main Page

BarGraph 5 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Filipovic
  • Date : Jun 2024.
  • Type : SPI type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of BarGraph 5 click board by changing the level of all BarGraph output channels.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
bargraph5_cfg_t bargraph5_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
bargraph5_cfg_setup( &bargraph5_cfg );
BARGRAPH5_MAP_MIKROBUS( bargraph5_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == bargraph5_init( &bargraph5, &bargraph5_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( BARGRAPH5_ERROR == bargraph5_default_cfg ( &bargraph5 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Changes the level of all BarGraph channels once per second. The channels level is displayed on the USB UART.

void application_task ( void )
{
{
log_printf( &logger, " Bars 0-2-4 level: %u\r\n", ( uint16_t ) cnt );
log_printf( &logger, " Bars 1-3-5 level: %u\r\n\n", ( uint16_t ) ( BARGRAPH5_LEVEL_4 - cnt ) );
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.BarGraph5

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.


BARGRAPH5_BAR_5
@ BARGRAPH5_BAR_5
Definition: bargraph5.h:172
BARGRAPH5_BAR_2
@ BARGRAPH5_BAR_2
Definition: bargraph5.h:169
bargraph5_bar_sel_t
bargraph5_bar_sel_t
BarGraph 5 Click select bar channel.
Definition: bargraph5.h:166
bargraph5_output_disable
void bargraph5_output_disable(bargraph5_t *ctx)
BarGraph 5 output disable function.
BARGRAPH5_ERROR
@ BARGRAPH5_ERROR
Definition: bargraph5.h:197
BARGRAPH5_BAR_4
@ BARGRAPH5_BAR_4
Definition: bargraph5.h:171
BARGRAPH5_MAP_MIKROBUS
#define BARGRAPH5_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: bargraph5.h:111
application_task
void application_task(void)
Definition: main.c:65
BARGRAPH5_LEVEL_4
@ BARGRAPH5_LEVEL_4
Definition: bargraph5.h:186
bargraph5_init
err_t bargraph5_init(bargraph5_t *ctx, bargraph5_cfg_t *cfg)
BarGraph 5 initialization function.
BARGRAPH5_BAR_3
@ BARGRAPH5_BAR_3
Definition: bargraph5.h:170
bargraph5_level_t
bargraph5_level_t
BarGraph 5 Click bar level.
Definition: bargraph5.h:181
BARGRAPH5_BAR_0
@ BARGRAPH5_BAR_0
Definition: bargraph5.h:167
bargraph5_default_cfg
err_t bargraph5_default_cfg(bargraph5_t *ctx)
BarGraph 5 default configuration function.
BARGRAPH5_LEVEL_0
@ BARGRAPH5_LEVEL_0
Definition: bargraph5.h:182
bargraph5_set_bar_level
err_t bargraph5_set_bar_level(bargraph5_t *ctx, bargraph5_bar_sel_t bar_num, bargraph5_level_t level, uint16_t brightness)
BarGraph 5 set bar level function.
BARGRAPH5_BAR_1
@ BARGRAPH5_BAR_1
Definition: bargraph5.h:168
application_init
void application_init(void)
Definition: main.c:29
bargraph5_cfg_setup
void bargraph5_cfg_setup(bargraph5_cfg_t *cfg)
BarGraph 5 configuration object setup function.
bargraph5_t
BarGraph 5 Click context object.
Definition: bargraph5.h:126
bargraph5_cfg_t
BarGraph 5 Click configuration object.
Definition: bargraph5.h:144
BARGRAPH5_BRIGHTNESS_DEFAULT
#define BARGRAPH5_BRIGHTNESS_DEFAULT
Definition: bargraph5.h:81
bargraph5_output_enable
void bargraph5_output_enable(bargraph5_t *ctx)
BarGraph 5 output enable function.