rtc.h File Reference
Go to the source code of this file.
Define Documentation
#define rtc_xday |
( |
x |
|
) |
rtc_rw(4,x) |
#define rtc_xdow |
( |
x |
|
) |
rtc_rw(3,x) |
#define rtc_xhour |
( |
x |
|
) |
rtc_rw(2,x) |
#define rtc_xminute |
( |
x |
|
) |
rtc_rw(1,x) |
#define rtc_xmonth |
( |
x |
|
) |
rtc_rw(5,x) |
#define rtc_xseconds |
( |
x |
|
) |
rtc_rw(0,x); |
#define rtc_xyear |
( |
x |
|
) |
rtc_rw(6,x) |
Typedef Documentation
Function Documentation
00073 {
00074 uint8_t i;
00075
00076 rtc_send(0);
00077 for (i = 0; i < 0x1a; i++) {
00078 rtc_send(0);
00079 printf_P(PSTR("%02x:%02x "), i, SPDR);
00080 }
00081 rtc_over();
00082 }
uint16_t rtc_gettime |
( |
uint8_t |
|
) |
|
00053 {
00054 uint16_t time = 0;
00055
00056
00057 rtc_send(ss ? 0 : 1);
00058
00059
00060 rtc_send(0);
00061 time = SPDR;
00062
00063
00064 rtc_send(0);
00065 while (!(SPSR & _BV(SPIF)));
00066 time |= SPDR<<8;
00067
00068 rtc_over();
00069
00070 return time;
00071 }
uint8_t rtc_rw |
( |
uint8_t |
addr, |
|
|
int8_t |
value | |
|
) |
| | |
00046 {
00047 rtc_send(addr | (value == -1 ? 0 : 0200));
00048 rtc_send(value);
00049 rtc_over();
00050 return SPDR;
00051 }
void rtc_send |
( |
uint8_t |
b |
) |
|
00036 {
00037 PORTRTCSEL &= ~_BV(RTCSEL);
00038 SPDR = b;
00039 spi_wait();
00040 }