upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the DS1307 Real-Time CLock. More...
UPM module for the DS1307-based real-time clock. The clock can provide information about seconds, minutes, hours, day of the week, day of the month, month, and year. It can operate in either a 24-hour or a 12-hour format. This device can also output a square wave at 1Khz, 4Khz, 8Khz, and 32Khz. However, this capability is not implemented in this module.
Public Member Functions | |
synchronized void | delete () |
DS1307 (int bus) | |
boolean | loadTime () |
boolean | setTime () |
int | enableClock () |
int | disableClock () |
int | writeBytes (short reg, byte[] buffer) |
int | readBytes (short reg, byte[] buffer) |
long | bcdToDec (short val) |
short | decToBcd (long val) |
void | setSeconds (long value) |
long | getSeconds () |
void | setMinutes (long value) |
long | getMinutes () |
void | setHours (long value) |
long | getHours () |
void | setDayOfWeek (long value) |
long | getDayOfWeek () |
void | setDayOfMonth (long value) |
long | getDayOfMonth () |
void | setMonth (long value) |
long | getMonth () |
void | setYear (long value) |
long | getYear () |
void | setAmPmMode (boolean value) |
boolean | getAmPmMode () |
void | setPm (boolean value) |
boolean | getPm () |
long bcdToDec | ( | short | val | ) |
Converts a BCD value into decimal
val | BCD value to convert |
short decToBcd | ( | long | val | ) |
Converts a decimal value into BCD
val | Decimal value to convert |
int disableClock | ( | ) |
Disables the oscillator on the clock. This prevents the clock from updating any time/date values
int enableClock | ( | ) |
Enables an oscillator on the clock.
boolean loadTime | ( | ) |
Loads all the time values
boolean setTime | ( | ) |
Sets the time. You should call loadTime() beforehand to maintain consistency