COSA
An Object-Oriented Platform for Arduino Programming
PCF8563 Class Reference

#include <PCF8563.hh>

Inheritance diagram for PCF8563:
Inheritance graph
Collaboration diagram for PCF8563:
Collaboration graph

Classes

struct  alarm_t
 
union  clock_control_t
 
union  control_status_1_t
 
union  control_status_2_t
 
struct  rtcc_t
 
union  timer_control_t
 

Public Member Functions

 PCF8563 ()
 
bool get_time (time_t &now)
 
bool set_time (time_t &now)
 
bool set_alarm (alarm_t &alarm)
 
bool get_alarm (alarm_t &alarm)
 
bool clear_alarm ()
 
bool pending_alarm ()
 

Protected Types

enum  { FD_32_768_KHZ, FD_1_024_KHZ, FD_32_HZ, FD_1_HZ }
 
enum  { TD_4_096_KHZ, TD_64_HZ, TD_1_HZ, TD_1v60_HZ }
 

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)
 

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
 

Detailed Description

Driver for the PCF8563, Low-Power I2C Real-Time Clock/Calendar (RTCC).

References

  1. NXP PCF8563 data sheet; http://www.nxp.com/documents/data_sheet/PCF8563.pdf

Definition at line 35 of file PCF8563.hh.

Member Enumeration Documentation

anonymous enum
protected

Frequency output in control register (FD, pp. 15).

Enumerator
FD_32_768_KHZ 

32.768 Hz

FD_1_024_KHZ 

1.024 Hz

FD_32_HZ 

32 Hz

FD_1_HZ 

1 Hz

Definition at line 173 of file PCF8563.hh.

anonymous enum
protected

Timer frequency in control register (TD, pp. 16).

Enumerator
TD_4_096_KHZ 

4.096 Hz.

TD_64_HZ 

64 Hz.

TD_1_HZ 

1 Hz.

TD_1v60_HZ 

1/60 Hz.

Definition at line 199 of file PCF8563.hh.

Constructor & Destructor Documentation

PCF8563::PCF8563 ( )
inline

Construct PCF8563 device with bus address(0x51).

Definition at line 40 of file PCF8563.hh.

Member Function Documentation

bool PCF8563::clear_alarm ( )

Clear the real-time clock alarm setting. Return true(1) if successful otherwise false(0).

Returns
boolean.

Definition at line 118 of file PCF8563.cpp.

bool PCF8563::get_alarm ( alarm_t alarm)

Read the real-time clock alarm setting. Return true(1) if successful otherwise false(0).

Parameters
[out]alarmmatch structure.
Returns
boolean.

Definition at line 77 of file PCF8563.cpp.

bool PCF8563::get_time ( time_t now)

Read current time from the real-time clock. Return true(1) if successful otherwise false(0).

Parameters
[out]nowtime structure return value.
Returns
boolean.

Definition at line 43 of file PCF8563.cpp.

bool PCF8563::pending_alarm ( )

Check any pending alarms (signalled on interrupt pin). Returns true(1) alarm pending otherwise false(0).

Returns
boolean.

Definition at line 107 of file PCF8563.cpp.

int PCF8563::read ( void *  regs,
uint8_t  size,
uint8_t  pos = 0 
)
protected

Read register block with the given size into the buffer from the position. Return number of bytes read or negative error code.

Parameters
[in]regsbuffer to read from register block.
[in]sizenumber of bytes to read.
[in]posaddress in register file to read from.
Returns
number of bytes or negative error code.

Definition at line 24 of file PCF8563.cpp.

bool PCF8563::set_alarm ( alarm_t alarm)

Set the real-time clock alarm. Return true(1) if successful otherwise false(0).

Parameters
[in]alarmmatch structure to set.
Returns
boolean.

Definition at line 90 of file PCF8563.cpp.

bool PCF8563::set_time ( time_t now)

Set the real-time clock to the given time. Return true(1) if successful otherwise false(0).

Parameters
[in]nowtime structure to set.
Returns
boolean.

Definition at line 62 of file PCF8563.cpp.

int PCF8563::write ( void *  regs,
uint8_t  size,
uint8_t  pos = 0 
)
protected

Write register block at given position with the contents from buffer. Return number of bytes written or negative error code.

Parameters
[in]regsbuffer to write to register block.
[in]sizenumber of bytes to write.
[in]posaddress in register file to read write to.
Returns
number of bytes or negative error code.

Definition at line 34 of file PCF8563.cpp.


The documentation for this class was generated from the following files: