Display current date and time.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include "stdio.h"
#include "keyboard.h"
#include "rtc32.h"
#include "calendar.h"
#include "sysfont.h"
#include "timezone.h"
#include "date_time.h"
#include "gfx_mono_menu.h"
#include "gfx_mono_spinctrl.h"
Functions | |
void | date_time_application (void) |
Show a menu presenting the date and time applications. More... | |
static void | display_date_time_application (void) |
Display current date and time in the selected timezone. More... | |
PROGMEM_DECLARE (char const, datetime_menu_title[]) | |
PROGMEM_DECLARE (char const, datetime_menu_1[]) | |
PROGMEM_DECLARE (char const, datetime_menu_2[]) | |
PROGMEM_DECLARE (char const, datetime_menu_3[]) | |
PROGMEM_DECLARE (char const, datetime_menu_4[]) | |
PROGMEM_DECLARE (char const, datetime_date_spinner_string_year[]) | |
PROGMEM_DECLARE (char const, datetime_date_spinner_string_month[]) | |
PROGMEM_DECLARE (char const, datetime_date_spinner_string_day[]) | |
PROGMEM_DECLARE (char const, datetime_date_spinner_string_hour[]) | |
PROGMEM_DECLARE (char const, datetime_date_spinner_string_minute[]) | |
PROGMEM_DECLARE (char const, datetime_invalid_date_string[]) | |
static void | set_date_application (void) |
Set the date using a spinner widget. More... | |
static void | set_time_application (void) |
Set the time using a spinner widget. More... | |
Variables | |
struct gfx_mono_menu | datetime_menu |
PROGMEM_STRING_T | datetime_menu_strings [] |
char * | day [] |
Weekday shortnames. More... | |
void date_time_application | ( | void | ) |
Show a menu presenting the date and time applications.
References display_date_time_application(), GFX_MONO_MENU_EVENT_IDLE, gfx_mono_menu_init(), gfx_mono_menu_process_key(), keyboard_get_key_state(), KEYBOARD_RELEASE, keyboard_event::keycode, set_date_application(), set_time_application(), timezone_select_application(), and keyboard_event::type.
Referenced by main().
|
static |
Display current date and time in the selected timezone.
References calendar_add_second_to_date(), calendar_timestamp_to_date_tz(), calendar_date::date, day, calendar_date::dayofweek, gfx_mono_draw_filled_rect, gfx_mono_draw_string(), gfx_mono_get_string_bounding_box(), GFX_MONO_LCD_WIDTH, GFX_PIXEL_CLR, calendar_date::hour, KEYBOARD_BACK, keyboard_get_key_state(), KEYBOARD_RELEASE, keyboard_event::keycode, calendar_date::minute, calendar_date::month, rtc_get_time(), calendar_date::second, sysfont, timezone_get_hours(), timezone_get_minutes(), keyboard_event::type, and calendar_date::year.
Referenced by date_time_application().
PROGMEM_DECLARE | ( | char | const, |
datetime_menu_title | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_menu_1 | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_menu_2 | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_menu_3 | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_menu_4 | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_date_spinner_string_year | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_date_spinner_string_month | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_date_spinner_string_day | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_date_spinner_string_hour | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_date_spinner_string_minute | [] | ||
) |
PROGMEM_DECLARE | ( | char | const, |
datetime_invalid_date_string | [] | ||
) |
|
static |
Set the date using a spinner widget.
This function will set show a spinner widget that lets the user select the current date. This function will leave the clock unchanged, and only change the date part of the RTC32 timestamp.
References calendar_date_to_timestamp_tz(), calendar_timestamp_to_date_tz(), calendar_date::date, gfx_mono_draw_filled_rect, gfx_mono_draw_progmem_string(), GFX_MONO_LCD_HEIGHT, GFX_MONO_LCD_WIDTH, GFX_MONO_SPINCTRL_EVENT_FINISH, gfx_mono_spinctrl_init(), gfx_mono_spinctrl_spincollection_add_spinner(), gfx_mono_spinctrl_spincollection_init(), gfx_mono_spinctrl_spincollection_process_key(), gfx_mono_spinctrl_spincollection_show(), GFX_PIXEL_CLR, calendar_date::hour, gfx_mono_spinctrl::integer_data, keyboard_get_key_state(), KEYBOARD_RELEASE, keyboard_event::keycode, calendar_date::minute, calendar_date::month, PROGMEM_PTR_T, rtc_get_time(), rtc_set_time(), calendar_date::second, SPINTYPE_INTEGER, sysfont, timezone_get_hours(), timezone_get_minutes(), keyboard_event::type, tz_hours, tz_minutes, and calendar_date::year.
Referenced by date_time_application().
|
static |
Set the time using a spinner widget.
References calendar_date_to_timestamp_tz(), calendar_timestamp_to_date_tz(), GFX_MONO_SPINCTRL_EVENT_FINISH, gfx_mono_spinctrl_init(), gfx_mono_spinctrl_spincollection_add_spinner(), gfx_mono_spinctrl_spincollection_init(), gfx_mono_spinctrl_spincollection_process_key(), gfx_mono_spinctrl_spincollection_show(), calendar_date::hour, gfx_mono_spinctrl::integer_data, keyboard_get_key_state(), KEYBOARD_RELEASE, keyboard_event::keycode, calendar_date::minute, rtc_get_time(), rtc_set_time(), SPINTYPE_INTEGER, timezone_get_hours(), timezone_get_minutes(), keyboard_event::type, tz_hours, and tz_minutes.
Referenced by date_time_application().
struct gfx_mono_menu datetime_menu |
PROGMEM_STRING_T datetime_menu_strings[] |
char* day[] |
Weekday shortnames.
Referenced by display_date_time_application().