WE310F5  39.00.000
m2mb_rtc_time.h File Reference

RTC module prototypes. More...

Go to the source code of this file.

Data Structures

struct  M2MB_RTC_TIME_T
 Structure to represent RTC time. More...
 

Functions

M2MB_STATUS_T m2mb_core_rtc_time_set (M2MB_RTC_TIME_T *pTm)
 Setting time to RTC module. More...
 
M2MB_STATUS_T m2mb_core_rtc_time_get (M2MB_RTC_TIME_T *pTm)
 Getting time from RTC module. More...
 
M2MB_STATUS_T m2mb_core_rtc_gps_epoch_get (uint64_t *ms)
 Getting time from RTC module since GPS Epoch. More...
 
M2MB_STATUS_T m2mb_core_rtc_default_time_set (VOID)
 Setting default time to RTC module. More...
 

Detailed Description

RTC module prototypes.

we866e4/epl/inc/modules/m2mb_rtc_time.h

Basic functions for RTC module are provided

Note
Dependencies:
"#include <m2mb_types.h>"
Author
Sandeep Itha
Date
02/16/2017

Definition in file m2mb_rtc_time.h.

Function Documentation

◆ m2mb_core_rtc_default_time_set()

M2MB_STATUS_T m2mb_core_rtc_default_time_set ( VOID  )

Setting default time to RTC module.

This API sets default time (01/01/2000,00:00:00+03) in Julian format to the RTC module

Returns
M2MB_OK on success, or an code on error.
Note
Its better to call this API in the initialization section of application to keep the track of time from the start of the application. m2mb_core_rtc_default_time_set();
int main()
{
{
return M2MB_OK;
}
else
{
return M2MB_ERROR;
}
}

◆ m2mb_core_rtc_gps_epoch_get()

M2MB_STATUS_T m2mb_core_rtc_gps_epoch_get ( uint64_t *  ms)

Getting time from RTC module since GPS Epoch.

Gets the time in milliseconds since the GPS Epoch.

Parameters
[out]msPointer to a ULONG64 to contain the GPS Epoch time in ms
Returns
M2MB_OK on success, or an code on error.
Note

m2mb_core_rtc_gps_epoch_get(&ms);

int main()
{
M2MB_RTC_TIME_T tm = { 0 };
ULONG ms = 0;
tm.day = 16;
tm.month = 2;
tm.year = 2017;
tm.hour = 0;
tm.minute = 0;
tm.second = 0;
tm.day_of_Week = 0;
{
return M2MB_ERROR;
}
...
{
return M2MB_ERROR;
}
...
return M2MB_OK;
else
return M2MB_ERROR;
}

◆ m2mb_core_rtc_time_get()

M2MB_STATUS_T m2mb_core_rtc_time_get ( M2MB_RTC_TIME_T pTm)

Getting time from RTC module.

This service gets time in Julian format from the RTC module

Parameters
[out]pTmPointer to a buffer to contain the Julian time.
Returns
M2MB_OK on success, or an code on error.
Note
Getting TIME from RTC module can only be done after Setting the TIME to RTC first. m2mb_core_rtc_time_get( &tm );
int main()
{
M2MB_RTC_TIME_T tm = { 0 };
tm.day = 16;
tm.month = 2;
tm.year = 2017;
tm.hour = 0;
tm.minute = 0;
tm.second = 0;
tm.day_of_Week = 0;
{
return M2MB_ERROR;
}
...
{
return M2MB_OK;
}
else
{
return M2MB_ERROR;
}
}

◆ m2mb_core_rtc_time_set()

M2MB_STATUS_T m2mb_core_rtc_time_set ( M2MB_RTC_TIME_T pTm)

Setting time to RTC module.

This API sets time in Julian format to the RTC module

Parameters
[out]pTmPointer to a structure of type M2MB_RTC_TIME_T containing the Julian time.
Returns
M2MB_OK on success, or an code on error.
Note

m2mb_core_rtc_time_set(&tm);

int main()
{
M2MB_RTC_TIME_T tm = { 0 };
tm.day = 16;
tm.month = 2;
tm.year = 2017;
tm.hour = 0;
tm.minute = 0;
tm.second = 0;
tm.day_of_Week = 0;
{
return M2MB_OK;
}
else
{
return M2MB_ERROR;
}
}