Rev 36 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
18 | jlesech | 1 | /**************************************************************************//** |
2 | * \brief DS1307 RTC library |
||
3 | * \author Copyright (C) 2011 Julien Le Sech - www.idreammicro.com |
||
4 | * \version 1.0 |
||
5 | * \date 20090501 |
||
6 | * |
||
7 | * This file is part of the iDreamMicro library. |
||
8 | * |
||
9 | * This library is free software: you can redistribute it and/or modify it under |
||
10 | * the terms of the GNU Lesser General Public License as published by the Free |
||
11 | * Software Foundation, either version 3 of the License, or (at your option) any |
||
12 | * later version. |
||
13 | * |
||
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
||
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
16 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
||
17 | * details. |
||
18 | * |
||
19 | * You should have received a copy of the GNU Lesser General Public License |
||
20 | * along with this program. If not, see http://www.gnu.org/licenses/ |
||
21 | ******************************************************************************/ |
||
22 | |||
23 | /**************************************************************************//** |
||
24 | * \headerfile ds1307.h |
||
25 | ******************************************************************************/ |
||
26 | |||
27 | #ifndef H__IDREAMMICRO__DS1307__H |
||
28 | #define H__IDREAMMICRO__DS1307__H |
||
29 | |||
30 | #ifdef _cplusplus |
||
31 | extern "C"{ |
||
32 | #endif |
||
33 | |||
34 | /****************************************************************************** |
||
35 | * Header file inclusions. |
||
36 | ******************************************************************************/ |
||
37 | |||
38 | #include <useful/datetime.h> |
||
39 | |||
40 | /****************************************************************************** |
||
41 | * Public type definitions. |
||
42 | ******************************************************************************/ |
||
43 | |||
44 | /**************************************************************************//** |
||
45 | * \typedef ds1307__hour_mode_t. |
||
46 | * \bried RTC hour mode. |
||
47 | ******************************************************************************/ |
||
48 | /**************************************************************************//** |
||
49 | * \enum ds1307__hour_modes. |
||
50 | * \bried RTC hour modes. |
||
51 | ******************************************************************************/ |
||
52 | typedef enum ds1307__hour_modes |
||
53 | { |
||
54 | DS1307__HOUR_MODE__24_HOUR = 0, /*!< 24-hour mode. */ |
||
55 | DS1307__HOUR_MODE__12_HOUR = 1 /*!< 12-hour mode. */ |
||
56 | } ds1307__hour_mode_t; |
||
57 | |||
58 | /****************************************************************************** |
||
59 | * Public function prototypes. |
||
60 | ******************************************************************************/ |
||
61 | |||
62 | /**************************************************************************//** |
||
63 | * \fn void ds1307__initialize(void) |
||
64 | * |
||
65 | * \brief Initialize DS1307 RTC. |
||
66 | ******************************************************************************/ |
||
67 | void |
||
68 | ds1307__initialize |
||
69 | ( |
||
70 | void |
||
71 | ); |
||
72 | |||
73 | /**************************************************************************//** |
||
74 | * \fn void ds1307__get_time( |
||
75 | * date_time__time_t* p_time, |
||
76 | * ds1307__hour_mode_t* p_hour_mode) |
||
77 | * |
||
78 | * \brief Get RTC time. |
||
79 | * |
||
80 | * \param p_time a pointer to fill with RTC time |
||
81 | * \param p_hour_mode a pointer to fill with RTC hour mode |
||
82 | ******************************************************************************/ |
||
83 | void |
||
84 | ds1307__get_time |
||
85 | ( |
||
86 | datetime__time_t* p_time, |
||
87 | ds1307__hour_mode_t* p_hour_mode |
||
88 | ); |
||
89 | |||
90 | /**************************************************************************//** |
||
91 | * \fn void ds1307__set_time( |
||
92 | * date_time__time_t* p_time, |
||
93 | * ds1307__hour_mode_t hour_mode) |
||
94 | * |
||
95 | * \brief Set RTC time. |
||
96 | * |
||
97 | * \param p_time time to set. p_time->meridiem isn't used in 12-hour mode. |
||
98 | * \param hour_mode hour mode |
||
99 | ******************************************************************************/ |
||
100 | void |
||
101 | ds1307__set_time |
||
102 | ( |
||
103 | datetime__time_t* p_time, |
||
104 | ds1307__hour_mode_t hour_mode |
||
105 | ); |
||
106 | |||
107 | /**************************************************************************//** |
||
108 | * \fn void ds1307__get_date(date_time__date_t* p_date) |
||
109 | * |
||
110 | * \brief Get RTC date. |
||
111 | * |
||
112 | * \param p_date a pointer to fill with RTC date |
||
113 | ******************************************************************************/ |
||
114 | void |
||
115 | ds1307__get_date |
||
116 | ( |
||
117 | datetime__date_t* p_date |
||
118 | ); |
||
119 | |||
120 | /**************************************************************************//** |
||
121 | * \fn void ds1307__set_date(date_time__date_t* p_date) |
||
122 | * |
||
123 | * \brief Set RTC date. |
||
124 | * |
||
125 | * \param p_date date to set |
||
126 | ******************************************************************************/ |
||
127 | void |
||
128 | ds1307__set_date |
||
129 | ( |
||
130 | datetime__date_t* p_date |
||
131 | ); |
||
132 | |||
133 | #ifdef _cplusplus |
||
134 | } |
||
135 | #endif |
||
136 | |||
137 | #endif /* H__IDREAMMICRO__DS1307__H */ |