Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

m41t80.h

00001 
00002 #ifndef M41T80_H
00003 #define M41T80_H
00004 
00005 #include "global.h"
00006 
00007 // device base address
00008 #define M41T80_I2C_BASE_ADDR    0x68
00009 
00010 // device registers
00011 #define M41T80_REG_DSECONDS     0x00
00012 #define M41T80_REG_SECONDS      0x01
00013 #define M41T80_REG_MINUTES      0x02
00014 #define M41T80_REG_HOURS        0x03
00015 #define M41T80_REG_DAYOFWEEK    0x04
00016 #define M41T80_REG_DAYOFMONTH   0x05
00017 #define M41T80_REG_MONTH        0x06
00018 #define M41T80_REG_YEAR         0x07
00019 #define M41T80_REG_CTRL         0x08
00020 #define M41T80_REG_WATCHDOG     0x09
00021 #define M41T80_REG_AL_MONTH     0x0A
00022 #define M41T80_REG_AL_DATE      0x0B
00023 #define M41T80_REG_AL_HOUR      0x0C
00024 #define M41T80_REG_AL_MINUTES   0x0D
00025 #define M41T80_REG_AL_SECONDS   0x0E
00026 #define M41T80_REG_FLAGS        0x0F
00027 #define M41T80_REG_SQW          0x13
00028 
00029 // functions
00030 
00031 // initializes RTC for operation
00032 void m41t80Init(void);
00033 
00034 // resets RTC and starts clock
00035 // WARNING: this clears the time!
00036 void m41t80Reset(void);
00037 
00038 // write RTC register
00039 void m41t80WriteReg(u08 regaddr, u08 data);
00040 
00041 // read RTC register
00042 u08 m41t80ReadReg(u08 regaddr);
00043 
00044 // set state of OUT pin
00045 void m41t80SetOutState(int state);
00046 
00047 // gets time in 32-bit BCD format (HH:MM:SS.ss)
00048 void m41t80SetTime(u32 time);
00049 
00050 // gets time in 32-bit BCD format (HH:MM:SS.ss)
00051 u32 m41t80GetTime(void);
00052 
00053 // print BCD time format (HH:MM:SS.ss)
00054 void m41t80PrintTime(u32 time);
00055 
00056 #endif

Generated on Mon Nov 6 23:36:59 2006 for Procyon ARMlib by  doxygen 1.4.2