rtc_ds3231 v0.1.1 RtcDs3231

Use a DS3231 real time clock with a nerves system

I have only tested this with a raspberry pi and the sunfounder ds3231 board

References

Summary

Functions

Read the real time clock and return the time as a NaiveDateTime. address is the 7 bit device address

Set the real time clock from a NaiveDateTime, discarding the century

Functions

rtc_datetime(address, century \\ 2000)

Specs

rtc_datetime(byte, integer) :: {:ok, NaiveDateTime}

Read the real time clock and return the time as a NaiveDateTime. address is the 7 bit device address.

Example:

RtcDs3231.rtc_datetime(0x68)

The chip apperas to store a 2 digit year and flip the century bit when it overflows, hence the need to pass in the century.

set_rtc_datetime(address, time)

Specs

set_rtc_datetime(byte, NaiveDateTime) :: :ok

Set the real time clock from a NaiveDateTime, discarding the century.

Example:

RtcDs3231.set_rtc_datetime(0x68, ~N[2018-01-02 11:50:12])