|
COSA
An Object-Oriented Platform for Arduino Programming
|
#include <MCP7940N.hh>


Classes | |
| struct | alarm_t |
| class | AlarmInterrupt |
| union | config_t |
| union | control_t |
| struct | rtcc_t |
| struct | timestamp_t |
Public Types | |
| enum | { SQW_1_HZ, SQW_4_096_KHZ, SQW_8_192_KHZ, SQW_32_768_KHZ } |
| enum | { WHEN_SEC_MATCH = 0x00, WHEN_MIN_MATCH = 0x01, WHEN_HOUR_MATCH = 0x02, WHEN_DAY_MATCH = 0x03, WHEN_DATE_MATCH = 0x04, WHEN_TIME_MATCH = 0x07 } |
Public Member Functions | |
| MCP7940N (Board::ExternalInterruptPin pin=Board::EXT1) | |
| bool | get_time (time_t &now) |
| bool | set_time (time_t &now) |
| bool | set_alarm (uint8_t nr, time_t &alarm, uint8_t when) |
| bool | get_alarm (uint8_t nr, time_t &alarm, uint8_t &when) |
| bool | clear_alarm (uint8_t nr) |
| uint8_t | pending_alarm () |
| bool | square_wave (bool flag) |
Static Public Attributes | |
| static const uint8_t | RAM_START = sizeof(rtcc_t) |
| static const uint8_t | RAM_END = 0x5f |
| static const uint8_t | RAM_MAX = RAM_END - RAM_START + 1 |
Protected Member Functions | |
| int | read (void *regs, uint8_t size, uint8_t pos=0) |
| int | write (void *regs, uint8_t size, uint8_t pos=0) |
Protected Attributes | |
| AlarmInterrupt | m_alarm_irq |
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 MCP7940N, Low-Cost I2C Real-Time Clock/Calendar (RTCC) with SRAM and Battery Switchover.
Definition at line 37 of file MCP7940N.hh.
| anonymous enum |
Rate Selection in control register (rs, pp. 10).
| Enumerator | |
|---|---|
| SQW_1_HZ |
1 Hz |
| SQW_4_096_KHZ |
4.096 Hz |
| SQW_8_192_KHZ |
8.192 Hz |
| SQW_32_768_KHZ |
32.768 Hz |
Definition at line 80 of file MCP7940N.hh.
| anonymous enum |
Alarm match types (pp. 10-11).
Definition at line 139 of file MCP7940N.hh.
|
inline |
Construct MCP7940N device with bus address(0x6f).
| [in] | pin | alarm interrupt pin (Default EXT1/EXT0). |
Definition at line 210 of file MCP7940N.hh.
| bool MCP7940N::clear_alarm | ( | uint8_t | nr | ) |
Clear given real-time clock alarm. Return true(1) if successful otherwise false(0).
| [in] | nr | alarm number (0..1). |
Definition at line 146 of file MCP7940N.cpp.
| bool MCP7940N::get_alarm | ( | uint8_t | nr, |
| time_t & | alarm, | ||
| uint8_t & | when | ||
| ) |
Read given real-time clock alarm time and configuration. Return true(1) if successful otherwise false(0).
| [in] | nr | alarm number (0..1). |
| [out] | alarm | time structure. |
| [out] | when | alarm should trigger. |
Definition at line 75 of file MCP7940N.cpp.
| bool MCP7940N::get_time | ( | time_t & | now | ) |
Read current time from real-time clock. Return true(1) if successful otherwise false(0).
| [out] | now | time structure return value. |
Definition at line 56 of file MCP7940N.cpp.
| uint8_t MCP7940N::pending_alarm | ( | ) |
Check any pending alarms (signalled on interrupt pin). Returns alarm pending (0 for no alarms, 1 for alarm0, 2 for alarm1 and 3 for both)
Definition at line 124 of file MCP7940N.cpp.
|
protected |
Read register block with the given size into the buffer from the position. Return number of bytes read or negative error code.
| [in] | regs | buffer to read from register block. |
| [in] | size | number of bytes to read. |
| [in] | pos | address in register file to read from. |
Definition at line 37 of file MCP7940N.cpp.
| bool MCP7940N::set_alarm | ( | uint8_t | nr, |
| time_t & | alarm, | ||
| uint8_t | when | ||
| ) |
Set given real-time clock alarm with the given time and configuration. Return true(1) if successful otherwise false(0).
| [in] | nr | alarm number (0..1). |
| [in] | alarm | time structure to set. |
| [in] | when | alarm should trigger. |
Definition at line 93 of file MCP7940N.cpp.
| bool MCP7940N::set_time | ( | time_t & | now | ) |
Set the real-time clock to the given time. Return true(1) if successful otherwise false(0).
| [in] | now | time structure to set. |
Definition at line 66 of file MCP7940N.cpp.
| bool MCP7940N::square_wave | ( | bool | flag | ) |
Enable/disable square_wave generation.
| [in] | flag. |
Definition at line 165 of file MCP7940N.cpp.
|
protected |
Write register block at given position with the contents from buffer. Return number of bytes written or negative error code.
| [in] | regs | buffer to write to register block. |
| [in] | size | number of bytes to write. |
| [in] | pos | address in register file to read write to. |
Definition at line 47 of file MCP7940N.cpp.
|
protected |
Definition at line 313 of file MCP7940N.hh.
|
static |
End of application RAM.
Definition at line 200 of file MCP7940N.hh.
Max size of application RAM (64 bytes).
Definition at line 203 of file MCP7940N.hh.
|
static |
Start of application RAM.
Definition at line 197 of file MCP7940N.hh.