C# Класс Raspberry.IO.Components.Clocks.Ds1307.Ds1307Connection

Provides functionality for the DS1307 Real-Time Clock.
The Clock Module needs to be modified to work with the Raspberry Pi according to this article: http://electronics.stackexchange.com/questions/98361/how-to-modify-ds1307-rtc-to-use-3-3v-for-raspberry-pi The Datasheet can be found here: http://www.alldatasheet.com/datasheet-pdf/pdf/58481/DALLAS/DS1307.html (the Memory Map is on Page 5. Note that the values in RAM are stored in Nibbles).
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
DisableRtc ( ) : void

Disables the Clock. When the Clock is diabled, it not ticking.

Ds1307Connection ( Raspberry.IO.InterIntegratedCircuit.I2cDeviceConnection connection ) : System

Creates a new instance of the class using the provided I2C Connection.

EnableRtc ( ) : void

Enables the Clock.

GetDate ( ) : System.DateTime

Reads the Date and Time from the Ds1307 and returns it.

IsRtcEnabled ( ) : bool

Returns true, if the Clock is enabled, otherwise false is returned.

ResetToFactoryDefaults ( ) : void

Resets the Clock to the Factory Defaults.

SetDate ( System.DateTime date ) : void

Writes the provided Date and Time to the Ds1307.

SystemTimeToRtc ( ) : void

Writes the current System Date to the Clock.

Приватные методы

Метод Описание
GetDate ( byte input ) : System.DateTime

Converts the provided bytes to a DateTime.

IntToNibble ( int number ) : byte

Converts the specified integer to a two-nibble-byte.

IsRtcEnabled ( byte seconds ) : bool

Returns true, if the Clock is enabled, otherwise false.

NibbleToInt ( byte nibble ) : int

Converts the specified two-nibble-byte to an integer.

ReadAll ( ) : byte[]

Reads 7 bytes from the Clock and returns them.

ReadSeconds ( ) : byte

Reads the Seconds-byte (first byte in the RAM) from the Clock and returns it.

SetEnabledDisableRtc ( byte seconds, bool disable ) : byte

Disables or enables the Clock.

The disable/enabled-Flag is stored in bit 7 within the seconds-byte.

Описание методов

DisableRtc() публичный Метод

Disables the Clock. When the Clock is diabled, it not ticking.
public DisableRtc ( ) : void
Результат void

Ds1307Connection() публичный Метод

Creates a new instance of the class using the provided I2C Connection.
public Ds1307Connection ( Raspberry.IO.InterIntegratedCircuit.I2cDeviceConnection connection ) : System
connection Raspberry.IO.InterIntegratedCircuit.I2cDeviceConnection I2C Connection to the Clock.
Результат System

EnableRtc() публичный Метод

Enables the Clock.
public EnableRtc ( ) : void
Результат void

GetDate() публичный Метод

Reads the Date and Time from the Ds1307 and returns it.
public GetDate ( ) : System.DateTime
Результат System.DateTime

IsRtcEnabled() публичный Метод

Returns true, if the Clock is enabled, otherwise false is returned.
public IsRtcEnabled ( ) : bool
Результат bool

ResetToFactoryDefaults() публичный Метод

Resets the Clock to the Factory Defaults.
public ResetToFactoryDefaults ( ) : void
Результат void

SetDate() публичный Метод

Writes the provided Date and Time to the Ds1307.
public SetDate ( System.DateTime date ) : void
date System.DateTime The Date that should be set.
Результат void

SystemTimeToRtc() публичный Метод

Writes the current System Date to the Clock.
public SystemTimeToRtc ( ) : void
Результат void