rtc13  2.0.0.0
Main Page

RTC 13 click

<PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU>

[click Product page](<CLICK_PRODUCT_PAGE_LINK>)


Click library

  • Author : Nenad Filipovic
  • Date : Jul 2021.
  • Type : SPI type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This is an example that demonstrates the use of the RTC 13 click boardâ„¢.

The demo application is composed of two sections :

Application Init

Initialization of SPI module, log UART and additional pins. After driver initialization and default settings, the app set the time to 23:59:50 and set the date to 04.08.2021.

void application_init ( void )
{
log_cfg_t log_cfg;
rtc13_cfg_t rtc13_cfg;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 115200;
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
rtc13_cfg_setup( &rtc13_cfg );
RTC13_MAP_MIKROBUS( rtc13_cfg, MIKROBUS_1 );
err_t init_flag = rtc13_init( &rtc13, &rtc13_cfg );
if ( SPI_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
rtc13_default_cfg ( &rtc13 );
log_info( &logger, " Application Task " );
Delay_ms( 100 );
date.weekday = 3;
date.day = 4;
date.month = 8;
date.year = 21;
rtc13_set_date( &rtc13, date );
Delay_ms( 100 );
time.hours = 23;
time.min = 59;
time.sec = 50;
rtc13_set_time( &rtc13, time );
Delay_ms( 100 );
}

Application Task

This is an example that shows the use of a RTC 13 click boardâ„¢. In this example, we read and display the current time and date, which we also previously set. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB changes every 1 sec.

void application_task ( void )
{
rtc13_get_time( &rtc13, &time );
Delay_ms( 1 );
rtc13_get_date( &rtc13, &date );
Delay_ms( 1 );
if ( time.sec != new_sec )
{
log_printf( &logger, " Date : %.2d-%.2d-%.2d\r\n", ( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
log_printf( &logger, " Time : %.2d:%.2d:%.2d\r\n", ( uint16_t ) time.hours, ( uint16_t ) time.min, ( uint16_t ) time.sec );
log_printf( &logger, "- - - - - - - - - - - -\r\n" );
new_sec = time.sec;
Delay_ms( 1 );
}
}

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

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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.


rtc13_cfg_setup
void rtc13_cfg_setup(rtc13_cfg_t *cfg)
RTC 13 configuration object setup function.
rtc13_time_t
RTC 13 Click time object.
Definition: rtc13.h:140
application_task
void application_task(void)
Definition: main.c:80
rtc13_get_time
err_t rtc13_get_time(rtc13_t *ctx, rtc13_time_t *rtc_time)
RTC 13 get time function.
rtc13_set_time
err_t rtc13_set_time(rtc13_t *ctx, rtc13_time_t rtc_time)
RTC 13 set time function.
rtc13_date_t
RTC 13 Click date object.
Definition: rtc13.h:152
rtc13_cfg_t
RTC 13 Click configuration object.
Definition: rtc13.h:197
rtc13_set_date
err_t rtc13_set_date(rtc13_t *ctx, rtc13_date_t rtc_date)
RTC 13 set date function.
rtc13_t
RTC 13 Click context object.
Definition: rtc13.h:178
application_init
void application_init(void)
Definition: main.c:37
rtc13_get_date
err_t rtc13_get_date(rtc13_t *ctx, rtc13_date_t *rtc_date)
RTC 13 get date function.
rtc13_init
err_t rtc13_init(rtc13_t *ctx, rtc13_cfg_t *cfg)
RTC 13 initialization function.
rtc13_default_cfg
err_t rtc13_default_cfg(rtc13_t *ctx)
RTC 13 default configuration function.
RTC13_MAP_MIKROBUS
#define RTC13_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: rtc13.h:124