C# Class Controller.DS1307

This class implements a complete driver for the Dallas Semiconductors / Maxim DS1307 I2C real-time clock: http://pdfserv.maxim-ic.com/en/ds/DS1307.pdf
Inheritance: IDisposable
显示文件 Open project: h07r0d/Netduino-Aquarium-Controller

Public Methods

Method Description
DS1307 ( ) : System
DS1307 ( Microsoft.SPOT.Hardware.I2CDevice device ) : System
Dispose ( ) : void

Releases clock resources

GetRAM ( ) : byte[]

Reads the clock's user RAM registers as a block.

ReadRegister ( byte address, int length = 1 ) : byte[]

Reads an arbitrary RTC or RAM register

SetRAM ( byte buffer ) : void

Writes to the clock's user RAM registers as a block

SetSquareWave ( SQWFreq Freq, SQWDisabledOutputControl OutCtrl = SQWDisabledOutputControl.Zero ) : void

Enables / Disables the square wave generation function of the clock. Requires a pull-up resistor on the clock's SQW pin.

WriteRegister ( byte address, byte data ) : void

Writes an arbitrary RTC or RAM register

this ( byte address ) : byte

Private Methods

Method Description
EncodeDate ( System.DateTime value, bool clockHalt, bool hourMode ) : byte[]
ParseDate ( byte clockData ) : System.DateTime

Method Details

DS1307() public method

public DS1307 ( ) : System
return System

DS1307() public method

public DS1307 ( Microsoft.SPOT.Hardware.I2CDevice device ) : System
device Microsoft.SPOT.Hardware.I2CDevice
return System

Dispose() public method

Releases clock resources
public Dispose ( ) : void
return void

GetRAM() public method

Reads the clock's user RAM registers as a block.
public GetRAM ( ) : byte[]
return byte[]

ReadRegister() public method

Reads an arbitrary RTC or RAM register
public ReadRegister ( byte address, int length = 1 ) : byte[]
address byte Register address between 0x00 and 0x3f
length int The number of bytes to read
return byte[]

SetRAM() public method

Writes to the clock's user RAM registers as a block
public SetRAM ( byte buffer ) : void
buffer byte A byte buffer of size DS1307_RAM_SIZE
return void

SetSquareWave() public method

Enables / Disables the square wave generation function of the clock. Requires a pull-up resistor on the clock's SQW pin.
public SetSquareWave ( SQWFreq Freq, SQWDisabledOutputControl OutCtrl = SQWDisabledOutputControl.Zero ) : void
Freq SQWFreq Desired frequency or disabled
OutCtrl SQWDisabledOutputControl Logical level of output pin when the frequency is disabled (zero by default)
return void

WriteRegister() public method

Writes an arbitrary RTC or RAM register
public WriteRegister ( byte address, byte data ) : void
address byte Register address between 0x00 and 0x3f
data byte
return void

this() public method

public this ( byte address ) : byte
address byte
return byte