COSA
An Object-Oriented Platform for Arduino Programming
|
#include <DS1307.hh>
Classes | |
union | control_t |
struct | timekeeper_t |
Public Types | |
enum | Rate { RS_1_HZ = 0, RS_4096_HZ = 1, RS_8192_HZ = 2, RS_32768_HZ = 3 } |
Public Member Functions | |
DS1307 () | |
int | read (void *ram, uint8_t size=sizeof(time_t), uint8_t pos=0) |
int | write (void *ram, uint8_t size=sizeof(time_t), uint8_t pos=0) |
bool | get_time (time_t &now) |
bool | set_time (time_t &now) |
bool | enable (Rate rs=RS_1_HZ) |
bool | disable () |
Static Public Attributes | |
static const uint8_t | RAM_START = sizeof(timekeeper_t) |
static const uint8_t | RAM_END = 0x3f |
static const uint8_t | RAM_MAX = RAM_END - RAM_START + 1 |
Private Member Functions | |
bool | is_async () const |
void | sync_request () |
void | async_request () |
virtual void | on_completion (uint8_t type, int count) |
Private Attributes | |
uint8_t | m_addr |
bool | m_async |
Driver for the DS1307, 64 X 8, Serial I2C Real-Time Clock, a low-power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM.
For further details see Maxim Integrated product description; http://datasheets.maximintegrated.com/en/ds/DS1307.pdf
enum DS1307::Rate |
|
inline |
bool DS1307::disable | ( | ) |
Disable clock output. Return true(1) if successful otherwise false(0).
Definition at line 57 of file DS1307.cpp.
Enable clock output with given rate. Return true(1) if successful otherwise false(0).
[in] | rs | rate selection (default 1 Hz). |
Definition at line 45 of file DS1307.cpp.
|
inline |
int DS1307::read | ( | void * | ram, |
uint8_t | size = sizeof(time_t) , |
||
uint8_t | pos = 0 |
||
) |
Read ram block with the given size into the buffer from the position. Return number of bytes read or negative error code.
[in] | ram | buffer to read from ram. |
[in] | size | number of bytes to read. |
[in] | pos | address in ram to read from. |
Definition at line 24 of file DS1307.cpp.
|
inline |
int DS1307::write | ( | void * | ram, |
uint8_t | size = sizeof(time_t) , |
||
uint8_t | pos = 0 |
||
) |
Write ram block at given position with the contents from buffer. Return number of bytes written or negative error code.
[in] | buf | buffer to write to ram. |
[in] | size | number of bytes to write. |
[in] | pos | address in ram to read write to. |
Definition at line 34 of file DS1307.cpp.
|
static |
|
static |