ds1338/ds1338.h File Reference

#include <stdint.h>

Go to the source code of this file.

Data Structures

union  ds1338DateTimeControl

Defines

#define DEVICE   0xD0
 DS1338 7 bit Address (aligned to left).
#define WRITE   0x00
 I2C write command.
#define READ   0x01
 I2C read command.
#define TWI_BITRATE   25000
 TWI bitrate.

Typedefs

typedef union ds1338DateTimeControl ds1338TDC

Enumerations

enum  ds1338_status {
  NO_ERROR, LOCATION_OUTOFBOUNDS, RANGE_OUTOFBOUNDS, NO_DEVICE,
  DEVICE_BUSY, BUS_ERROR
}

Functions

void ds1338_setup ()
ds1338_status ds1338_readTimeDateControl (ds1338TDC *data)
ds1338_status ds1338_writeTimeDateControl (ds1338TDC *data)
ds1338_status ds1338_writeBufferToNVRAM (uint8_t start, uint8_t lenght, uint8_t *data)
ds1338_status ds1338_readBufferFromNVRAM (uint8_t start, uint8_t lenght, uint8_t *data)
ds1338_status ds1338_writeByteToNVRAM (uint8_t location, uint8_t data)
ds1338_status ds1338_readByteFromNVRAM (uint8_t location, uint8_t *data)

Detailed Description

Author:
Krzysztof Wesolowski
Date:
September 09, 2009

Definition in file ds1338.h.


Typedef Documentation

Union storing Date/Time data, compiler dependant, tested only with AVR-GCC


Enumeration Type Documentation

ds1338 related function can return one of this return-codes

Enumerator:
NO_ERROR 

NO_ERROR.

LOCATION_OUTOFBOUNDS 

LOCATION_OUTOFBOUNDS.

RANGE_OUTOFBOUNDS 

RANGE_OUTOFBOUNDS.

NO_DEVICE 

NO_DEVICE.

DEVICE_BUSY 

DEVICE_BUSY.

BUS_ERROR 

BUS_ERROR.

Definition at line 54 of file ds1338.h.


Function Documentation

ds1338_status ds1338_readBufferFromNVRAM ( uint8_t  location,
uint8_t  lenght,
uint8_t *  data 
)

Read data from RTC NVRAM

Parameters:
location Starting location of readed data
lenght Lenght of read data
data Pointer where data we'll be stored
Returns:
DS1338 status code

Definition at line 138 of file ds1338.c.

References NO_ERROR, RANGE_OUTOFBOUNDS, twi_receive(), and twi_stop().

Referenced by ds1338_readTimeDateControl().

ds1338_status ds1338_readByteFromNVRAM ( uint8_t  location,
uint8_t *  data 
)

Read single byte from RTC NVRAM

Parameters:
location location of data in RTC
data Pointer where data we'll be stored
Returns:
DS1338 status code

Definition at line 184 of file ds1338.c.

References NO_ERROR, twi_receive(), and twi_stop().

ds1338_status ds1338_readTimeDateControl ( ds1338TDC data  ) 

Retrieves Time/Data data from RTC

Parameters:
data Pointer to target memory buffer
Returns:
DS1338 status code

Definition at line 92 of file ds1338.c.

References ds1338_readBufferFromNVRAM().

void ds1338_setup (  ) 

Initiates uC to work with DS1338 twi interface.

Definition at line 15 of file ds1338.c.

References TWI_BITRATE.

ds1338_status ds1338_writeBufferToNVRAM ( uint8_t  location,
uint8_t  lenght,
uint8_t *  data 
)

Writes specified data to RTC NVRAM

Parameters:
location Target starting location
lenght Data lenght
data Pointer to data
Returns:
DS1338 status code

Definition at line 114 of file ds1338.c.

References DEVICE_BUSY, NO_ERROR, RANGE_OUTOFBOUNDS, twi_send(), and twi_stop().

Referenced by ds1338_writeTimeDateControl().

ds1338_status ds1338_writeByteToNVRAM ( uint8_t  location,
uint8_t  data 
)

Writes signle byte to RTC NVRAM

Parameters:
location Target location
data Data to be stored
Returns:
DS1338 status code

Definition at line 165 of file ds1338.c.

References DEVICE_BUSY, NO_ERROR, twi_send(), and twi_stop().

ds1338_status ds1338_writeTimeDateControl ( ds1338TDC data  ) 

Stores data in RTC - sets Time/Date

Parameters:
data Pointer to ds1338TDC structure
Returns:
DS1338 status code

Definition at line 102 of file ds1338.c.

References ds1338_writeBufferToNVRAM().


Generated on Wed Sep 9 20:37:11 2009 for DS1338Library by  doxygen 1.6.1