Atmel Software Framework

production_date.h File Reference

Display time since production.

Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.

Functions

void production_date_application (void)
 Production date application. More...
 
uint32_t production_date_get_timestamp (void)
 Production date get timestamp. More...
 

void production_date_application ( void  )

Production date application.

This application will display the time since the XMEGA-A3BU Xplained board has been produced. During production the production time is stored in EEPROM and the RTC is initialized to the same time. The RTC is then left running from the battery backup. This application reads out the production date from EEPROM and shows the difference between the current time and the production date; in other words the time the RTC timer has been running on battery since production.

Note
If the EEPROM is erased and no production date can be set, it will default to time 01.01.1970, the start of the UNIX time epoch.

References calendar_time_between_dates(), calendar_timestamp_to_date(), calendar_date::date, 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, production_date_get_timestamp(), rtc_get_time(), calendar_date::second, sysfont, keyboard_event::type, and calendar_date::year.

Referenced by main().

uint32_t production_date_get_timestamp ( void  )

Production date get timestamp.

This function reads the production date time stamp stored in the user signature row addresses PRODUCTION_DATE_ADDRESS to PRODUCTION_DATE_ADDRESS + 3 (4 bytes) and returns a 32 bit value in the UNIX time format.

Returns
Production date timestamp

References FIRST_POSSIBLE_TIMESTAMP, and nvm_read_user_signature_row().

Referenced by main(), and production_date_application().