2013-11-27 17:54:30 +01:00
|
|
|
/*
|
2013-08-16 10:20:23 +02:00
|
|
|
* Copyright 2010, Freie Universitaet Berlin (FUB). All rights reserved.
|
|
|
|
*
|
2014-08-23 15:43:13 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-08-27 18:47:31 +02:00
|
|
|
*/
|
2010-12-13 01:29:46 +01:00
|
|
|
|
2013-03-13 21:56:56 +01:00
|
|
|
/**
|
2013-11-27 17:54:30 +01:00
|
|
|
* @defgroup rtc Realtime Clock
|
|
|
|
* @ingroup drivers
|
2014-05-24 16:06:05 +02:00
|
|
|
* @brief Generic real time clock driver interface
|
2013-03-13 21:56:56 +01:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2010-12-13 01:29:46 +01:00
|
|
|
#ifndef RTC_H
|
|
|
|
#define RTC_H
|
|
|
|
|
2010-12-16 18:21:24 +01:00
|
|
|
#define RTC_SECOND 10001U
|
|
|
|
|
2010-12-13 01:29:46 +01:00
|
|
|
#include <time.h>
|
2013-10-19 20:15:41 +02:00
|
|
|
#include <sys/time.h>
|
2014-07-06 22:57:56 +02:00
|
|
|
#include "kernel_types.h"
|
2010-12-13 01:29:46 +01:00
|
|
|
|
2014-10-13 15:49:17 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-12-13 01:29:46 +01:00
|
|
|
/**
|
|
|
|
* @brief Initializes the RTC for calendar mode
|
|
|
|
*/
|
|
|
|
void rtc_init(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Starts the RTC
|
|
|
|
*/
|
|
|
|
void rtc_enable(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Stops the RTC
|
|
|
|
*/
|
|
|
|
void rtc_disable(void);
|
|
|
|
|
|
|
|
/**
|
2013-11-27 17:54:30 +01:00
|
|
|
* @brief Sets the current time in broken down format directly from to RTC
|
|
|
|
* @param[in] localt Pointer to structure with time to set
|
2010-12-13 01:29:46 +01:00
|
|
|
*/
|
2013-06-21 22:36:48 +02:00
|
|
|
void rtc_set_localtime(struct tm *localt);
|
2010-12-13 01:29:46 +01:00
|
|
|
|
|
|
|
/**
|
2013-11-27 17:54:30 +01:00
|
|
|
* @brief Returns the current time in broken down format directly from the RTC
|
|
|
|
* @param[out] localt Pointer to structure to receive time
|
2010-12-13 01:29:46 +01:00
|
|
|
*/
|
2013-06-21 22:36:48 +02:00
|
|
|
void rtc_get_localtime(struct tm *localt);
|
2010-12-13 01:29:46 +01:00
|
|
|
|
2013-10-19 20:15:41 +02:00
|
|
|
/**
|
2013-11-27 17:54:30 +01:00
|
|
|
* @brief Get the current time as a struct timeval
|
|
|
|
* @param[out] time Pointer to structure to receive time
|
2013-10-19 20:15:41 +02:00
|
|
|
*/
|
|
|
|
time_t rtc_time(struct timeval *time);
|
|
|
|
|
2014-07-06 22:57:56 +02:00
|
|
|
extern kernel_pid_t rtc_second_pid;
|
2010-12-16 18:21:24 +01:00
|
|
|
|
2014-10-13 15:49:17 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-03-13 21:56:56 +01:00
|
|
|
/** @} */
|
2013-11-27 17:54:30 +01:00
|
|
|
#endif
|