CuVoodoo STM32F1 firmware template
Macros | Functions | Variables
rtc_dcf77.c File Reference

library to get time from a DCF77 module (code) More...

Go to the source code of this file.

Macros

#define RTC_DCF77_ENABLE_PORT   A
 GPIO port to enable the module.
 
#define RTC_DCF77_ENABLE_PIN   2
 GPIO pinto enable the module.
 
#define RTC_DCF77_SIGNAL_PORT   A
 GPIO port to capture the DCF signal.
 
#define RTC_DCF77_SIGNAL_PIN   3
 GPIO pin to capture the DCF signal.
 
#define RTC_DCF77_TIMER   4
 timer peripheral
 
#define RTC_DCF77_INVALID_MAX   5
 maximum number of invalid decoding before switching off
 

Functions

void rtc_dcf77_setup (void)
 setup DCF77 time receiver module
 
void rtc_dcf77_on (void)
 switch on DCF77 time receiver module More...
 
void rtc_dcf77_off (void)
 switch off DCF77 time receiver module
 
static void rtc_dcf77_decode (void)
 decode rtc_dcf77_frame DCF77 frame into rtc_dcf77_time DCF77 time More...
 
static void rtc_dcf77_phase_detector (void)
 find phase of 1 seconds DCF77 signal in the bins searches the complete second for the highest correlation if the phase it not locked searches only around the last phase if locked saves the new phase with the highest correlation
 
void TIM_ISR() RTC_DCF77_TIMER (void)
 interrupt service routine called for timer
 

Variables

volatile bool rtc_dcf77_time_flag = false
 set when time information has been received
 
struct rtc_dcf77_time_t rtc_dcf77_time = {false, 0, 0, 0, 0, 0, 0, 0, 0}
 the received DCF77 frame bits
 
static volatile uint64_t rtc_dcf77_frame = 0
 
static uint8_t rtc_dcf77_bins [100] = {0}
 values of the DCF77 signal over 10 ms for 1 s (how many times it is high)
 
static uint8_t rtc_dcf77_phase = 0
 the bin shift for the bit phase
 
static int16_t rtc_dcf77_phase_max = INT16_MIN
 the maximum phase value
 
static bool rtc_dcf77_phase_locked = false
 if the current phase has been verified
 
static uint8_t rtc_dcf77_invalid = 0
 number of invalid decoding
 

Detailed Description

library to get time from a DCF77 module (code)

Author
King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
Date
2016-2017
Note
peripherals used: GPIO output to enable DCF module and input to capture DCF signal, timer timer to sample DCF77 signal

Definition in file rtc_dcf77.c.

Function Documentation

◆ rtc_dcf77_decode()

static void rtc_dcf77_decode ( void  )
static

decode rtc_dcf77_frame DCF77 frame into rtc_dcf77_time DCF77 time

Note
check valid for validity

Definition at line 116 of file rtc_dcf77.c.

◆ rtc_dcf77_on()

void rtc_dcf77_on ( void  )

switch on DCF77 time receiver module

Note
it switches back off after too many invalid decoding attempts

Definition at line 93 of file rtc_dcf77.c.