|
upm
1.5.0
Sensor/Actuator repository for libmraa (v1.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 | |
| DS1307 (int bus) | |
| bool | loadTime () |
| bool | setTime () |
| mraa::Result | enableClock () |
| mraa::Result | disableClock () |
| mraa::Result | writeBytes (uint8_t reg, uint8_t *buffer, int len) |
| int | readBytes (uint8_t reg, uint8_t *buffer, int len) |
| unsigned int | bcdToDec (uint8_t val) |
| uint8_t | decToBcd (unsigned int val) |
Data Fields | |
| unsigned int | seconds |
| unsigned int | minutes |
| unsigned int | hours |
| unsigned int | dayOfWeek |
| unsigned int | dayOfMonth |
| unsigned int | month |
| unsigned int | year |
| bool | amPmMode |
| bool | pm |
| bool loadTime | ( | ) |
Loads all the time values

| bool setTime | ( | ) |
Sets the time. You should call loadTime() beforehand to maintain consistency

| mraa::Result enableClock | ( | ) |
Enables an oscillator on the clock.

| mraa::Result disableClock | ( | ) |
Disables the oscillator on the clock. This prevents the clock from updating any time/date values

| mraa::Result writeBytes | ( | uint8_t | reg, |
| uint8_t * | buffer, | ||
| int | len | ||
| ) |
Writes value(s) into registers
| reg | Register location to start writing into |
| buffer | Buffer for data storage |
| len | Number of bytes to write |

| int readBytes | ( | uint8_t | reg, |
| uint8_t * | buffer, | ||
| int | len | ||
| ) |
Reads value(s) from registers
| reg | Register location to start reading from |
| buffer | Buffer for data storage |
| len | Number of bytes to read |

| unsigned int bcdToDec | ( | uint8_t | val | ) |
Converts a BCD value into decimal
| val | BCD value to convert |

| uint8_t decToBcd | ( | unsigned int | val | ) |
Converts a decimal value into BCD
| val | Decimal value to convert |

| unsigned int seconds |
Holds seconds
| unsigned int minutes |
Holds minutes
| unsigned int hours |
Holds hours; 1-12 in the am/pm format, 0-23 otherwise
| unsigned int dayOfWeek |
Holds a day of the week; 1-7, where 1 is Sunday
| unsigned int dayOfMonth |
Holds a day of the month, 1-31
| unsigned int month |
Holds a month, 1-12
| unsigned int year |
Holds a year, 0-99
| bool amPmMode |
True if the am/pm format is used, false otherwise
| bool pm |
For the am/pm format, it is true if it's pm, false otherwise
1.8.11