2010-12-13 01:29:46 +01:00
|
|
|
/******************************************************************************
|
2013-08-16 10:20:23 +02:00
|
|
|
* Copyright 2010, Freie Universitaet Berlin (FUB). All rights reserved.
|
|
|
|
*
|
|
|
|
* These sources were developed at the Freie Universitaet Berlin, Computer Systems
|
2010-12-13 01:29:46 +01:00
|
|
|
and Telematics group (http://cst.mi.fu-berlin.de).
|
2013-08-16 10:20:23 +02:00
|
|
|
* ----------------------------------------------------------------------------
|
|
|
|
* This file is part of RIOT.
|
|
|
|
*
|
2013-11-22 20:47:05 +01:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
2013-08-16 10:20:23 +02:00
|
|
|
* Public License. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
|
|
|
*
|
2010-12-13 01:29:46 +01:00
|
|
|
*******************************************************************************/
|
|
|
|
|
2013-03-13 21:56:56 +01:00
|
|
|
/**
|
2013-11-27 16:28:31 +01:00
|
|
|
* @defgroup rtc Realtime Clock
|
|
|
|
* @ingroup drivers
|
|
|
|
* @brief Generic real time clock driver
|
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-11-15 00:29:13 +01:00
|
|
|
|
|
|
|
/* TODO: remove once msp430 libc supports struct timeval */
|
2013-11-15 11:14:07 +01:00
|
|
|
#ifndef MSP430
|
2013-10-19 20:15:41 +02:00
|
|
|
#include <sys/time.h>
|
2013-11-15 00:29:13 +01:00
|
|
|
#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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the current time in broken down format directly from to RTC
|
|
|
|
* @param[in] localt Pointer to structure with time to set
|
|
|
|
*/
|
2013-06-21 22:36:48 +02:00
|
|
|
void rtc_set_localtime(struct tm *localt);
|
2010-12-13 01:29:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns the current time in broken down format directly from the RTC
|
|
|
|
* @param[out] localt Pointer to structure to receive time
|
|
|
|
*/
|
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
|
|
|
/**
|
|
|
|
* @brief Get the current time as a struct timeval
|
|
|
|
* @param[out] time Pointer to structure to receive time
|
|
|
|
*/
|
|
|
|
time_t rtc_time(struct timeval *time);
|
|
|
|
|
2010-12-16 18:21:24 +01:00
|
|
|
extern int rtc_second_pid;
|
|
|
|
|
2010-12-13 01:29:46 +01:00
|
|
|
#endif
|
2013-03-13 21:56:56 +01:00
|
|
|
/** @} */
|