RTC 15 Click
RTC 15 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 : Mar 2025.
- Type : I2C type
Software Support
Example Description
This example demonstrates the use of the RTC 15 Click board by initializing the device and setting up the current time and date. It continuously reads and displays the updated time and date every second using the timer countdown interrupt pin.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.RTC15
Example Key Functions
- rtc15_cfg_setup This function initializes Click configuration structure to initial values.
void rtc15_cfg_setup(rtc15_cfg_t *cfg)
RTC 15 configuration object setup function.
RTC 15 Click configuration object.
Definition rtc15.h:264
- rtc15_init This function initializes all necessary pins and peripherals used for this Click board.
err_t rtc15_init(rtc15_t *ctx, rtc15_cfg_t *cfg)
RTC 15 initialization function.
RTC 15 Click context object.
Definition rtc15.h:243
- rtc15_default_cfg This function executes a default configuration of RTC 15 Click board.
err_t rtc15_default_cfg(rtc15_t *ctx)
RTC 15 default configuration function.
- rtc15_set_time This function sets the current time (hours, minutes, seconds) in the RTC.
err_t rtc15_set_time(rtc15_t *ctx, rtc15_time_t *time)
RTC 15 set time function.
RTC 15 Click time object.
Definition rtc15.h:283
- rtc15_read_time This function reads the current time (hours, minutes, seconds) from the RTC.
err_t rtc15_read_time(rtc15_t *ctx, rtc15_time_t *time)
RTC 15 read time function.
- rtc15_read_date This function reads the current date (day, day of week, month, year) from the RTC.
err_t rtc15_read_date(rtc15_t *ctx, rtc15_date_t *date)
RTC 15 read date function.
RTC 15 Click date object.
Definition rtc15.h:296
Application Init
Initializes the logger and the RTC 15 Click driver, applies the default configuration, and sets the starting time and date.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( I2C_MASTER_ERROR ==
rtc15_init( &rtc15, &rtc15_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
time.hour = 23;
time.minute = 59;
time.second = 50;
{
log_printf( &logger, " Set time: %.2u:%.2u:%.2u\r\n",
( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
}
date.day = 31;
date.month = 12;
date.year = 24;
{
log_printf( &logger, " Set date: %s, %.2u.%.2u.20%.2u.\r\n",
rtc15_get_day_of_week_name ( date.day_of_week ),
( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
}
log_info( &logger, " Application Task " );
}
#define RTC15_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition rtc15.h:228
#define RTC15_TUESDAY
Definition rtc15.h:192
err_t rtc15_set_date(rtc15_t *ctx, rtc15_date_t *date)
RTC 15 set date function.
void application_init(void)
Definition main.c:44
@ RTC15_OK
Definition rtc15.h:310
@ RTC15_ERROR
Definition rtc15.h:311
Application Task
Waits for a 1 Hz interrupt signal and then reads and displays the current time and date.
{
{
log_printf( &logger, " Time: %.2u:%.2u:%.2u\r\n",
( uint16_t ) time.hour, ( uint16_t ) time.minute, ( uint16_t ) time.second );
}
{
log_printf( &logger, " Date: %s, %.2u.%.2u.20%.2u.\r\n\n",
rtc15_get_day_of_week_name ( date.day_of_week ),
( uint16_t ) date.day, ( uint16_t ) date.month, ( uint16_t ) date.year );
}
Delay_ms ( 100 );
}
uint8_t rtc15_get_int_pin(rtc15_t *ctx)
RTC 15 get interrupt pin function.
void application_task(void)
Definition main.c:99
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.