Nut/OS  4.10.3
API Reference
ds1307rtc.h File Reference
#include <dev/rtc.h>
Include dependency graph for ds1307rtc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int DS1307Init (void)
 Initialize the interface to an Dallas DS1307 hardware clock.
int DS1307RtcGetClock (struct _tm *tm)
 Get date and time from an DS1307 hardware clock.
int DS1307RtcSetClock (CONST struct _tm *tm)
 Set the DS1307 hardware clock.
int DS1307RtcReadRegs (uint8_t addr, uint8_t *buff, size_t len)
 Read RTC registers.
int DS1307RtcWrite (CONST uint8_t *buff, size_t len)
 Write to RTC registers.
int DS1307RamRead (uint8_t addr, uint8_t *buff, size_t cnt)
 Read contents from DS1307 RAM.
int DS1307RamWrite (uint8_t addr, CONST void *buff, size_t len)
 Store buffer contents in DS1307 RAM.

Variables

NUTRTC rtcDs1307

Function Documentation

int DS1307Init ( void  )

Initialize the interface to an Dallas DS1307 hardware clock.

Returns:
0 on success or -1 in case of an error.

Definition at line 228 of file ds1307rtc.c.

References DS1307RtcReadRegs(), DS1307RtcWrite(), and TwInit().

Here is the call graph for this function:

int DS1307RtcGetClock ( struct _tm tm)

Get date and time from an DS1307 hardware clock.

Parameters:
tmPoints to a structure that receives the date and time information.
Returns:
0 on success or -1 in case of an error.

Definition at line 126 of file ds1307rtc.c.

References BCD2BIN, DS1307RtcReadRegs(), _tm::tm_hour, _tm::tm_mday, _tm::tm_min, _tm::tm_mon, _tm::tm_sec, _tm::tm_wday, and _tm::tm_year.

Here is the call graph for this function:

int DS1307RtcSetClock ( CONST struct _tm tm)

Set the DS1307 hardware clock.

Parameters:
tmPoints to a structure which contains the date and time information.
Returns:
0 on success or -1 in case of an error.

Definition at line 151 of file ds1307rtc.c.

References BIN2BCD, DS1307RtcWrite(), and memset().

Here is the call graph for this function:

int DS1307RtcReadRegs ( uint8_t  reg,
uint8_t buff,
size_t  cnt 
)

Read RTC registers.

Parameters:
regThe first register to read.
buffPointer to a buffer that receives the register contents.
cntThe number of registers to read.
Returns:
0 on success or -1 in case of an error.

Definition at line 89 of file ds1307rtc.c.

References I2C_SLA_RTC, NUT_WAIT_INFINITE, and TwMasterTransact().

Referenced by DS1307Init(), DS1307RamRead(), and DS1307RtcGetClock().

Here is the call graph for this function:

int DS1307RtcWrite ( CONST uint8_t buff,
size_t  cnt 
)

Write to RTC registers.

Parameters:
buffThis buffer must contain all bytes to be transfered to the RTC chip, including the register address.
cntNumber of valid bytes in the buffer.
Returns:
0 on success or -1 in case of an error.

Definition at line 110 of file ds1307rtc.c.

References I2C_SLA_RTC, NUT_WAIT_INFINITE, and TwMasterTransact().

Referenced by DS1307Init(), and DS1307RtcSetClock().

Here is the call graph for this function:

int DS1307RamRead ( uint8_t  addr,
uint8_t buff,
size_t  cnt 
)

Read contents from DS1307 RAM.

Parameters:
addrStart location.
buffPoints to a buffer that receives the contents.
cntNumber of bytes to read.
Returns:
0 on success or -1 in case of an error.

Definition at line 178 of file ds1307rtc.c.

References DS1307RtcReadRegs().

Here is the call graph for this function:

int DS1307RamWrite ( uint8_t  addr,
CONST void *  buff,
size_t  len 
)

Store buffer contents in DS1307 RAM.

Parameters:
addrStorage start location.
buffPoints to a buffer that contains the bytes to store.
lenNumber of valid bytes in the buffer.
Returns:
0 on success or -1 in case of an error.

Definition at line 199 of file ds1307rtc.c.

References CONST, free(), I2C_SLA_RTC, malloc(), memcpy(), NUT_WAIT_INFINITE, and TwMasterTransact().

Here is the call graph for this function:


Variable Documentation

Definition at line 252 of file ds1307rtc.c.