PER Firmware
Loading...
Searching...
No Matches
rtc_sync.c File Reference

Synchronization of the RTC peripheral with the GPS UTC time. More...

#include "rtc_sync.h"
#include "common/phal_F4/rtc/rtc.h"
#include "main.h"
#include "can_library/generated/VCAN.h"
Include dependency graph for rtc_sync.c:

Macros

#define PAYLOAD_OFFSET   (sizeof(uint32_t) + sizeof(bool (*)(void)))
 

Functions

 RTOS_DEFINE_QUEUE (gps_time_queue, timestamped_frame_t, 1)
 
static RTC_timestamp_t RTC_from_gps (timestamped_frame_t gps_time)
 
void RTC_sync_init (void)
 
void RTC_sync (void)
 

Variables

RTC_timestamp_t fallback_timestamp
 
volatile uint32_t last_RTC_sync_time = 0
 
volatile bool is_RTC_sync_complete = false
 

Detailed Description

Synchronization of the RTC peripheral with the GPS UTC time.

Author
Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
Shriya Balu (balu@.nosp@m.purd.nosp@m.ue.ed.nosp@m.u)

Macro Definition Documentation

◆ PAYLOAD_OFFSET

#define PAYLOAD_OFFSET   (sizeof(uint32_t) + sizeof(bool (*)(void)))

Function Documentation

◆ RTC_from_gps()

static RTC_timestamp_t RTC_from_gps ( timestamped_frame_t gps_time)
static
Here is the caller graph for this function:

◆ RTC_sync()

void RTC_sync ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RTC_sync_init()

void RTC_sync_init ( void )
Here is the caller graph for this function:

◆ RTOS_DEFINE_QUEUE()

RTOS_DEFINE_QUEUE ( gps_time_queue ,
timestamped_frame_t ,
1  )

Variable Documentation

◆ fallback_timestamp

RTC_timestamp_t fallback_timestamp
Initial value:
={
.date = {
.month_bcd = RTC_MONTH_UNKNOWN,
.weekday = RTC_WEEKDAY_UNKNOWN,
.day_bcd = 0x00,
.year_bcd = 0x00
},
.time = {
.hours_bcd = 0x00,
.minutes_bcd = 0x00,
.seconds_bcd = 0x00,
.time_format = RTC_FORMAT_24_HOUR
},
}
@ RTC_FORMAT_24_HOUR
Definition rtc.h:69
@ RTC_MONTH_UNKNOWN
Definition rtc.h:42
@ RTC_WEEKDAY_UNKNOWN
Definition rtc.h:58

◆ is_RTC_sync_complete

volatile bool is_RTC_sync_complete = false

◆ last_RTC_sync_time

volatile uint32_t last_RTC_sync_time = 0