2016-08-14 18:37:58 +02:00
|
|
|
/* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/** library to get time from a DCF77 module (API)
|
|
|
|
* @file rtc_dcf77.h
|
|
|
|
* @author King Kévin <kingkevin@cuvoodoo.info>
|
2017-10-08 18:36:32 +02:00
|
|
|
* @date 2016-2017
|
2016-08-14 18:37:58 +02:00
|
|
|
* @note peripherals used: GPIO @ref rtc_dcf77_gpio, timer @ref rtc_dcf77_timer
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/** set when time information has been received */
|
|
|
|
extern volatile bool rtc_dcf77_time_flag;
|
|
|
|
|
2017-10-13 15:49:48 +02:00
|
|
|
/** decoded DCF77 time received */
|
|
|
|
extern struct rtc_dcf77_time_t {
|
|
|
|
bool valid; /**< if the time is valid */
|
|
|
|
uint8_t milliseconds; /**< milliseconds (00-99) */
|
|
|
|
uint8_t seconds; /**< seconds (always 0) */
|
|
|
|
uint8_t minutes; /**< minutes (00-49) */
|
|
|
|
uint8_t hours; /**< hours (00-23) */
|
|
|
|
uint8_t day; /**< day of the month (01-31) */
|
|
|
|
uint8_t weekday; /**< day of the week (1-7=Monday-Sunday) */
|
|
|
|
uint8_t month; /**< month (01-12) */
|
|
|
|
uint8_t year; /**< year within century (00-99) */
|
|
|
|
} rtc_dcf77_time;
|
|
|
|
|
2016-08-14 18:37:58 +02:00
|
|
|
/** setup DCF77 time receiver module */
|
|
|
|
void rtc_dcf77_setup(void);
|
2017-10-13 15:49:48 +02:00
|
|
|
/** switch on DCF77 time receiver module
|
|
|
|
* @note it switches back off after too many invalid decoding attempts
|
|
|
|
*/
|
2016-08-14 18:37:58 +02:00
|
|
|
void rtc_dcf77_on(void);
|
|
|
|
/** switch off DCF77 time receiver module */
|
|
|
|
void rtc_dcf77_off(void);
|