SdFat
Functions | Variables
FsDateTime Namespace Reference

Functions

void clearCallback ()
 
void setCallback (void(*dateTime)(uint16_t *date, uint16_t *time))
 
void setCallback (void(*dateTime)(uint16_t *date, uint16_t *time, uint8_t *ms10))
 

Variables

void(* callback )(uint16_t *date, uint16_t *time, uint8_t *ms10) = NULL
 
void(* callback2 )(uint16_t *date, uint16_t *time) = NULL
 

Detailed Description

Date time callback.

Date time callback

Function Documentation

◆ clearCallback()

void FsDateTime::clearCallback ( )

Cancel callback.

◆ setCallback() [1/2]

void FsDateTime::setCallback ( void(*)(uint16_t *date, uint16_t *time)  dateTime)

Set the date/time callback function.

Parameters
[in]dateTimeThe user's call back function. The callback. function is of the form:
void dateTime(uint16_t* date, uint16_t* time) {
uint16_t year;
uint8_t month, day, hour, minute, second;
// User gets date and time from GPS or real-time clock here.
// Return date using FS_DATE macro to format fields.
*date = FS_DATE(year, month, day);
// Return time using FS_TIME macro to format fields.
*time = FS_TIME(hour, minute, second);
}

Sets the function that is called when a file is created or when a file's directory entry is modified by sync(). All timestamps, access, creation, and modify, are set when a file is created. sync() maintains the last access date and last modify date/time.

◆ setCallback() [2/2]

void FsDateTime::setCallback ( void(*)(uint16_t *date, uint16_t *time, uint8_t *ms10)  dateTime)

Set the date/time callback function.

Parameters
[in]dateTimeThe user's call back function. The callback function is of the form:
void dateTime(uint16_t* date, uint16_t* time, uint8_t* ms10) {
uint16_t year;
uint8_t month, day, hour, minute, second;
// User gets date and time from GPS or real-time clock here.
// Return date using FS_DATE macro to format fields
*date = FS_DATE(year, month, day);
// Return time using FS_TIME macro to format fields
*time = FS_TIME(hour, minute, second);
// Return tenths of milliseconds since last even second.
// The granularity of the seconds part of FS_TIME is 2 seconds so
// this field is a count of tenths of a second and its valid value
// range is 0-199 inclusive.
// For a simple RTC return 100*(seconds & 1).
*ms10 = <tens of ms since even second>
}

Sets the function that is called when a file is created or when a file's directory entry is modified by sync(). All timestamps, access, creation, and modify, are set when a file is created. sync() maintains the last access date and last modify date/time.

Variable Documentation

◆ callback

void(* FsDateTime::callback = NULL

Date time callback.

◆ callback2

void(* FsDateTime::callback2 = NULL

Date time callback.