RTC: RTC.c File Reference

Real Time Clock

RTC.c File Reference

Real Time Clock APP Implementation Source File. More...


Detailed Description

Real Time Clock APP Implementation Source File.

Date:
2015-11-18

NOTE: This file is generated by DAVE. Any manual modification done to this file will be lost when the code is regenerated.

Definition in file RTC.c.

#include "rtc.h"

Functions

DAVE_APP_VERSION_t RTC_GetAppVersion (void)
 Get RTC APP version.
RTC_STATUS_t RTC_Init (RTC_t *const handler)
 Initializes RTC module.
RTC_STATUS_t RTC_SetTime (XMC_RTC_TIME_t *current_time)
 Sets the time.
void RTC_GetTime (XMC_RTC_TIME_t *current_time)
 Gets the time.
RTC_STATUS_t RTC_SetAlarmTime (XMC_RTC_ALARM_t *alarm)
 Sets the alarm time.
void RTC_GetAlarmTime (XMC_RTC_ALARM_t *alarm)
 Gets the alarm time.
uint32_t RTC_GetFlagStatus (void)
 Gets the flag status.
RTC_STATUS_t RTC_Time (time_t *time_value)
 Returns the time in seconds since the epoch time(01/01/1970).

Function Documentation

void RTC_GetAlarmTime ( XMC_RTC_ALARM_t *  alarm)

Gets the alarm time.

Parameters:
timePointer to structure of type XMC_RTC_ALARM_t
Returns:
None

Example: Pre-requisite: Instantiate RTC APP and generate code before copying below code snippet.

 #include <DAVE.h>
 XMC_RTC_ALARM_t alarm =
 {
   .seconds = 0U,
   .minutes = 1U,
   .hours = 0U,
   .days = 1U,
   .month = 1,
   .year = 1970U
 };
 int main(void)
 {
  RTC_STATUS_t status = RTC_STATUS_FAILURE;
  DAVE_Init();
  RTC_Stop();
  status = RTC_SetAlarmTime(&alarm);
  if(status == RTC_STATUS_SUCCESS)
  {
    RTC_GetAlarmTime(&alarm);
  }
   // ... infinite loop ...
   while(1)
   {}
 }


Definition at line 354 of file RTC.c.

uint32_t RTC_GetFlagStatus ( void  )

Gets the flag status.

Parameters:
None
Returns:
uint32_t flag status

Example: Pre-requisite: Instantiate RTC APP and generate code before copying below code snippet.

 #include <DAVE.h>
 int main(void)
 {
   DAVE_Init(); // RTC_Init(&RTC_0); is called inside DAVE_Init()
   if(RTC_GetFlagStatus()& RTC_STSSR_SPSE_Msk) // check if the periodic seconds event has occurred.
   {
   }
   while(1)
   {}
 }


Definition at line 367 of file RTC.c.

void RTC_GetTime ( XMC_RTC_TIME_t *  time)

Gets the time.

Parameters:
timePointer to structure of type XMC_RTC_TIME_t
Returns:
None

Example: Pre-requisite: Instantiate RTC APP and generate code before copying below code snippet.

 #include <DAVE.h>
 XMC_RTC_TIME_t timeval =
 {
   .seconds = 0U,
   .minutes = 0U,
   .hours = 0U,
   .days = 1U,
   .month = 1,
   .year = 1970U
 };
 int main(void)
 {
  RTC_STATUS_t status = RTC_STATUS_FAILURE;
  DAVE_Init();
  RTC_Stop();
  status = RTC_SetTime(&timeval);
  if(status == RTC_STATUS_SUCCESS)
  {
    RTC_GetTime(&timeval);
  }
  // ... infinite loop ...
  while(1)
  {}
 }


Definition at line 307 of file RTC.c.

RTC_STATUS_t RTC_Init ( RTC_t *const  handle)

Initializes RTC module.

Parameters:
handleConstant pointer to RTC structure of type RTC_t
Returns:
RTC_STATUS_t
Description:
Configures the RTC module registers as per settings updated in UI and enables the RTC module.

Example: Pre-requisite: Instantiate RTC APP and generate code before copying below code snippet.

  #include <DAVE.h>
  int main(void)
  {
    DAVE_Init(); // RTC_Init(&RTC_0) will be called within DAVE_Init()
    // ... infinite loop ...
    while(1)
    {}
  }


Definition at line 125 of file RTC.c.

References RealTimeClock::config, RealTimeClock::initialized, RTC_Start(), RTC_START_ENABLE, RTC_STATUS_FAILURE, RTC_STATUS_SUCCESS, and RTC_CONFIG::start.

RTC_STATUS_t RTC_SetAlarmTime ( XMC_RTC_ALARM_t *  alarm)

Sets the alarm time.

Parameters:
alarmPointer to structure of type XMC_RTC_ALARM_t
Returns:
RTC_STATUS_t

Example: Pre-requisite: Instantiate RTC APP and generate code before copying below code snippet.

 #include <DAVE.h>
 XMC_RTC_ALARM_t alarm =
 {
    .seconds = 0U,
    .minutes = 1U,
    .hours = 0U,
    .days = 1U,
    .month = 1,
    .year = 1970U
 };
 int main(void)
 {
   RTC_STATUS_t status = RTC_STATUS_FAILURE;
   DAVE_Init();
   RTC_Stop();
   status = RTC_SetAlarmTime(&alarm);
   if(status != RTC_STATUS_SUCCESS)
   {
           //error
   }
   // ... infinite loop ...
   while(1)
   {}
 }


Definition at line 320 of file RTC.c.

References RTC_STATUS_FAILURE, and RTC_STATUS_SUCCESS.

RTC_STATUS_t RTC_SetTime ( XMC_RTC_TIME_t *  time)

Sets the time.

Parameters:
timePointer to structure of type XMC_RTC_TIME_t
Returns:
RTC_STATUS_t

Example: Pre-requisite: Instantiate RTC APP and generate code before copying below code snippet.

 #include <DAVE.h>
 XMC_RTC_TIME_t timeval =
 {
    .seconds = 0U,
    .minutes = 0U,
    .hours = 0U,
    .days = 1U,
    .month = 1,
    .year = 1970U
 };
 int main(void)
 {
   RTC_STATUS_t status = RTC_STATUS_FAILURE;
   DAVE_Init();
   RTC_Stop();
   status = RTC_SetTime(&timeval);
   if(status != RTC_STATUS_SUCCESS)
   {
           //error
   }
   // ... infinite loop ...
   while(1)
   {}
 }


Definition at line 274 of file RTC.c.

References RTC_STATUS_FAILURE, and RTC_STATUS_SUCCESS.

RTC_STATUS_t RTC_Time ( time_t *  time_value)

Returns the time in seconds since the epoch time(01/01/1970).

Parameters:
time_valuePointer to structure of type time_t
Returns:
RTC_STATUS_t

Example: Pre-requisite: Instantiate RTC APP and generate code before copying below code snippet.

 #include <DAVE.h>
 int main(void)
 {
   RTC_STATUS_t status = RTC_STATUS_FAILURE;
   time_t Time_Sec;
   DAVE_Init();  // RTC_Init(&RTC_0) will be called within DAVE_Init()
   status = RTC_Time(&Time_Sec);
   if(status != RTC_STATUS_SUCCESS)
   {
           //error
   }
   // ... infinite loop ...
   while(1)
   {}
 }


Definition at line 380 of file RTC.c.

References RTC_STATUS_FAILURE, and RTC_STATUS_SUCCESS.

Go to the source code of this file.