Unit DS1307

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


Maxim DS1307 Real Time Clock Driver unit

The Maxim DS1307 is an I2C interface, battery backed real time clock chip with full BCD clock and calendar and 56 bytes of software accessible NVRAM. The chip supports 12 or 24 hour format and is widely used in low cost RTC devices available from a range of suppliers.

This driver extends the real time clock API to include functions for directly reading and writing the NVRAM which could be used for storing device specific information and configuration or for non volatile storage of keys, passwords or tokens.

Constants



[Expand]
DS1307 specific constants DS1307_*


[Expand]
DS1307 chip DS1307_CHIP_*


[Expand]
DS1307 RTC register DS1307_REG_*


[Expand]
DS1307 control and status register DS1307_REG_*


[Expand]
DS1307 seconds register DS1307_REG_SECONDS_*


[Expand]
DS1307 hour register DS1307_REG_HOUR_*


[Expand]
MCP794XX weekday register MCP794XX_REG_WEEKDAY_*


[Expand]
DS1337 month register DS1337_REG_MONTH_*


[Expand]
DS1307 control register DS1307_REG_CONTROL_*


[Expand]
DS1337 control register DS1337_REG_CONTROL_*


[Expand]
DS1340 control register DS1340_REG_CONTROL_*


[Expand]
DS1340 flag register DS1340_REG_FLAG_*


[Expand]
DS1337 status register DS1337_REG_STATUS_*


[Expand]
RX8025 control1 register RX8025_REG_CONTROL1_*


[Expand]
RX8025 control2 register RX8025_REG_CONTROL2_*


Type definitions



DS1307 RTC time

[Expand]

PDS1307RTCTime = ^TDS1307RTCTime;

TDS1307RTCTime = array[0..6] of Byte;

DS1307 RTC device

[Expand]

PDS1307RTCDevice = ^TDS1307RTCDevice;

TDS1307RTCDevice = record


Public variables


None defined

Function declarations



Initialization functions

[Expand]
procedure DS1307Init;
Description: To be documented


DS1307 RTC functions

[Expand]
function DS1307RTCStart(RTC:PRTCDevice):LongWord;
Description: Implementation of RTCDeviceStart API for DS1307 RTC


[Expand]
function DS1307RTCStop(RTC:PRTCDevice):LongWord;
Description: Implementation of RTCDeviceStop API for DS1307 RTC


[Expand]
function DS1307RTCGetTime(RTC:PRTCDevice):Int64;
Description: Implementation of RTCDeviceGetTime API for DS1307 RTC


[Expand]
function DS1307RTCSetTime(RTC:PRTCDevice; const Time:Int64):Int64;
Description: Implementation of RTCDeviceSetTime API for DS1307 RTC


DS1307 helper functions

[Expand]
function DS1307ReadRTC(RTC:PRTCDevice; Buffer:Pointer; Size:LongWord):LongWord;
Description: To be documented


[Expand]
function DS1307WriteRTC(RTC:PRTCDevice; Buffer:Pointer; Size:LongWord):LongWord;
Description: To be documented


[Expand]
function DS1307ReadNVRAM(RTC:PRTCDevice; Offset:Byte; Buffer:Pointer; Size:LongWord):LongWord;
Description: To be documented


[Expand]
function DS1307WriteNVRAM(RTC:PRTCDevice; Offset:Byte; Buffer:Pointer; Size:LongWord):LongWord;
Description: To be documented


[Expand]
function DS1307ReadControl(RTC:PRTCDevice; var Control:Byte):LongWord;
Description: To be documented


[Expand]
function DS1307WriteControl(RTC:PRTCDevice; Control:Byte):LongWord;
Description: To be documented


[Expand]
function DS1307DefaultRTCTime(RTC:PRTCDevice; Buffer:Pointer; Size:LongWord):Boolean;
Description: To be documented


[Expand]
function DS1307FileTimeToRTCTime(RTC:PRTCDevice; const FileTime:Int64; Buffer:Pointer; Size:LongWord):Boolean;
Description: To be documented


[Expand]
function DS1307RTCTimeToFileTime(RTC:PRTCDevice; Buffer:Pointer; Size:LongWord; var FileTime:Int64):Boolean;
Description: To be documented


Return to Unit Reference