Real-Time Clock (RTC) example for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | char_to_digit(c) ((c) - '0') |
#define | MAX_EDIT_SIZE 10 |
#define | STATE_MENU 0 |
#define | STATE_SET_DATE 2 |
#define | STATE_SET_DATE_ALARM 4 |
#define | STATE_SET_TIME 1 |
#define | STATE_SET_TIME_ALARM 3 |
#define | STATE_WAVEFORM 5 |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static uint32_t | calculate_week (uint32_t ul_year, uint32_t ul_month, uint32_t ul_day) |
Calculate week from year, month, day. More... | |
static void | configure_console (void) |
Configure UART console. More... | |
static uint32_t | get_new_date (void) |
Get new time. More... | |
static uint32_t | get_new_time (void) |
Get new time. More... | |
int | main (void) |
Application entry point for RTC example. More... | |
static void | refresh_display (void) |
Display the user interface on the terminal. More... | |
void | RTC_Handler (void) |
Interrupt handler for the RTC. More... | |
Variables | |
static uint8_t | gs_uc_date [10+1] |
static uint8_t | gs_uc_day_names [7][4] |
static uint8_t | gs_uc_rtc_time [8+1] |
static uint32_t | gs_ul_alarm_triggered = 0 |
static uint32_t | gs_ul_menu_shown = 0 |
static uint32_t | gs_ul_new_day |
static uint32_t | gs_ul_new_hour |
static uint32_t | gs_ul_new_minute |
static uint32_t | gs_ul_new_month |
static uint32_t | gs_ul_new_second |
static uint32_t | gs_ul_new_week |
static uint32_t | gs_ul_new_year |
static uint32_t | gs_ul_state = STATE_MENU |
#define char_to_digit | ( | c | ) | ((c) - '0') |
Referenced by get_new_date(), get_new_time(), and main().
#define MAX_EDIT_SIZE 10 |
#define STATE_MENU 0 |
Referenced by main(), and refresh_display().
#define STATE_SET_DATE 2 |
Referenced by main().
#define STATE_SET_DATE_ALARM 4 |
Referenced by main().
#define STATE_SET_TIME 1 |
Referenced by main().
#define STATE_SET_TIME_ALARM 3 |
Referenced by main().
#define STATE_WAVEFORM 5 |
Referenced by main().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
|
static |
Calculate week from year, month, day.
Referenced by get_new_date().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
|
static |
Get new time.
Successful value is put in gs_ul_new_year, gs_ul_new_month, gs_ul_new_day, gs_ul_new_week.
References calculate_week(), and char_to_digit.
Referenced by main().
|
static |
Get new time.
Successful value is put in gs_ul_new_hour, gs_ul_new_minute, gs_ul_new_second.
References char_to_digit.
Referenced by main().
int main | ( | void | ) |
Application entry point for RTC example.
References board_init(), char_to_digit, configure_console(), get_new_date(), get_new_time(), refresh_display(), rtc_clear_date_alarm(), rtc_clear_time_alarm(), rtc_enable_interrupt(), rtc_set_date(), rtc_set_date_alarm(), rtc_set_hour_mode(), rtc_set_time(), rtc_set_time_alarm(), rtc_set_waveform(), STATE_MENU, STATE_SET_DATE, STATE_SET_DATE_ALARM, STATE_SET_TIME, STATE_SET_TIME_ALARM, STATE_WAVEFORM, STRING_HEADER, and sysclk_init().
|
static |
Display the user interface on the terminal.
References rtc_get_date(), rtc_get_time(), and STATE_MENU.
Referenced by main(), and RTC_Handler().
void RTC_Handler | ( | void | ) |
Interrupt handler for the RTC.
Refresh the display.
References refresh_display(), rtc_clear_status(), rtc_disable_interrupt(), rtc_enable_interrupt(), and rtc_get_status().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |