XBee Firmware Library  1.6.0
Functions
DS1904 Real-Time Clock

Functions

uint32_t ds1904_date_convert (tm_rtc_t date)
 Converts a date to epoch time. More...
 
ssize_t ds1904_date_update (uint8_t *rom)
 Reads the RTC time-register and updates global time. More...
 
void ds1904_get_date (tm_rtc_t *date)
 Returns current date and time from RTC. More...
 
ssize_t ds1904_read (uint8_t *rom, uint8_t *config, uint32_t *time)
 Reads configuration and time registers. More...
 
ssize_t ds1904_set (uint8_t *rom, bool_t enable)
 Enables or disables RTC's oscillator maintaining current time value. More...
 
ssize_t ds1904_write (uint8_t *rom, uint8_t config, uint32_t time)
 Writes configuration and time registers. More...
 

Detailed Description

DS1904 API Overview

This API contains the functions to configure and control a DS1904 Real-Time-Clock over a 1-Wire bus.

Platform-specific layer provides a consistent MACROS API to upper layers of the driver.

DS1904 RTC Macros

The DS1904 has 2 specific commands that are defined as the following macros:

Function Documentation

uint32_t ds1904_date_convert ( tm_rtc_t  date)

Converts a date to epoch time.

Parameters
[in]dateaddress where ROM of device is stored.
Return values
datein epoch time (0 for 0:00 of 1/1/1970).
ssize_t ds1904_date_update ( uint8_t rom)

Reads the RTC time-register and updates global time.

Parameters
[in]romaddress where ROM of device is stored. NULL if only one device is connected to the 1-Wire bus.
Return values
0on success.
<0if there is any error.
void ds1904_get_date ( tm_rtc_t date)

Returns current date and time from RTC.

Parameters
[out]dateaddress where current date will be written.
Return values
void
ssize_t ds1904_read ( uint8_t rom,
uint8_t config,
uint32_t time 
)

Reads configuration and time registers.

Parameters
[in]romaddress where ROM of device is stored. NULL if only one device is connected to the 1-Wire bus.
[out]configaddress where configuration register will be stored.
[out]timeaddress where time-count register will be stored.
Return values
0on success.
<0if there is any error.
ssize_t ds1904_set ( uint8_t rom,
bool_t  enable 
)

Enables or disables RTC's oscillator maintaining current time value.

Parameters
[in]romaddress where ROM of device is stored. NULL if only one device is connected to the 1-Wire bus.
[in]enableTRUE for enabling and FALSE for disabling.
Return values
0on success.
<0if there is any error.
ssize_t ds1904_write ( uint8_t rom,
uint8_t  config,
uint32_t  time 
)

Writes configuration and time registers.

Parameters
[in]romaddress where ROM of device is stored. NULL if only one device is connected to the 1-Wire bus.
[in]configconfiguration register to be written.
[in]timetime-count register to be written.
Return values
0on success.
<0if there is any error.