• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

ds3231.h

Go to the documentation of this file.
00001 /* Support for DS3231 Real Time Clock
00002 
00003         DS3231 is an I2C device
00004         Requires I2C support, calls i2c.c
00005         This in turn requires a call of i2c_timerproc every 10mS to
00006         avoid failed I2C calls from blocking
00007         
00008         Make sure that TWI is initialised correctly before use. See note in i2c.c
00009 
00010 */
00011 
00012 /* 15/12/2011  svn 479  */
00013 
00014 
00015 
00016 /* Note that if using the alarm, you need to write values to the alarm
00017 registers, then write the interrupt enable bits to the control register.
00018 Once the interrupt occurs, you need to write to the status register to clear the interrupt.
00019 Unsetting the bit in the control register is not enough 
00020 */
00021 
00022 #ifndef DS3231_H
00023 #define DS3231_H
00024 
00025 
00026 #include <avr/io.h>
00027 #include "config.h"
00028 #include <util/delay.h>
00029 #include <util/delay_basic.h>
00030 #include "i2c.h"
00031 
00032 
00033 
00034 
00038 void reset_rtc_i2c(void);
00039 
00040 
00041 
00050 uint8_t read_from_rtc(uint8_t *store_data);
00051 
00052 
00053 
00062 uint8_t write_to_rtc(uint8_t *store_data);
00063 
00064 
00065 
00075 uint8_t write_alarm(uint8_t *alarm_data);
00076 
00077 
00078 
00087 uint8_t read_temp_from_rtc(uint8_t *store_data);
00088 
00089 
00090 
00098 uint8_t set_rtc_register_pointer(uint8_t val);
00099 
00100 
00101 
00108 uint32_t get_fattime(void);
00109 
00110 
00111 
00125 void dirname_from_date(uint8_t *dirname,uint8_t *time_store);
00126 
00127 
00128 
00142 void filename_from_date(uint8_t *filename,uint8_t *time_store);
00143 
00144 
00145 
00157 void iso_time(uint8_t *iso_time_store,uint8_t *time_store);
00158 
00159 
00160 
00170 void americandate(uint8_t *result,uint8_t *time_store);
00171 
00172 
00173 
00183 void hms_time(uint8_t *result,uint8_t *time_store);
00184 
00185 
00186 
00193 uint8_t hex2ascii_h(uint8_t hexval);
00194 
00195 
00196 
00203 uint8_t hex2ascii_l(uint8_t hexval);
00204 
00205 
00206 
00216 uint8_t bcd_to_hex(uint8_t bcd);
00217 
00218 
00219 
00230 uint8_t set_datetime(uint8_t *iso_time_store);
00231 
00232 
00233 
00244 void addtime(uint8_t *result, uint8_t *start, uint16_t seconds);
00245 
00246 
00247 #endif

Generated on Wed Aug 22 2012 11:44:35 by  doxygen 1.7.1