PCF8563 I2C Real-time clock/calendar/alarm/timer Library

I basically just wrapped up this post / tutorial in nice and userfriendly class.

Warning: untested as of now (My package didn't yet arrive :P)

The API:

/*
 PCF8563.h - Library for working with NXP's RTC 8563.
 Created by Sol Bekic (S0lll0s), August, 2014.
 Released into the public domain.
 */
#define PCF8563_OSC_OFF       0
#define PCF8563_OSC_1HZ       B10000011
#define PCF8563_OSC_32KHZ     B10000010
#define PCF8563_OSC_1.024KHZ  B10000001
#define PCF8563_OSC_32.768KHZ B10000000

#define PCF8563_ALARM_MINUTE    B10000000
#define PCF8563_ALARM_HOUR      B01000000
#define PCF8563_ALARM_DAYOFWEEK B00100000
#define PCF8563_ALARM_DAY       B00010000

class PCF8563
{
public:
  PCF8563();
  PCF8563(int address);
  void setDate(pcf8563date date);                // set date
  void setTime(pcf8563time time);                // set time
  void setTimeAndDate(pcf8563datetime all);      // set time and date
  void setOscillator(int mode);                  // set the oscillator frequency or disable it
  void setAlarm(pcf8563alarm alarm);             // set alarm; OR PCF856_ALARM_* together to set which values (minute, hour...) are active
  void disableAlarm();                           // disable a triggered alarm
  void enableHardwareAlarm(boolean state);       // make alarm available on the PCF's pin 3 (open-drain)
  pcf8563time     getTime();                     // read the current time
  pcf8563date     getDate();                     // read the current date
  pcf8563datetime getTimeAndDate();              // read the current time and date
  boolean isTimeAccurate();                      // check if time (might) be inaccurate (timer was turned off). If it is, rewrite the time to unset
  boolean wasAlarmTriggered();                   // check if the alarm has been triggered. Use disableAlarm() to unset
private:
  int bcdToDec(int value);
  int decToBcd(int value);
  int _address;
};

It would be awesome if someone was able to test this.

PCF8563.zip (2.2 KB)

no such chip (or datasheet) but a few comments

as an i2c address fits in a byte (uint8_t) you should probably

PCF8563(uint8_t address);
...
uint8_t _address;

void setOscillator(int mode); // shouldn't that be a byte too? reduce footprint (every byte counts)

I did not dive into the code yet

You are correct, and I originally had all the internal values typed as "byte". That however threw an error on every "requestFrom", something like "ISO C++ says requestFrom(int, int) and requestFrom(uint8, uint8) should be ambiguous but worst ...of the first Is worse than worst... Of the second"
I searched for the error and found a thread where someone told to just put int, and t

you could add casting in those places, please try

requestFrom( (int) _address, (int) nr_of_bytes);

gives the compiler the info to solve the ambiguousness

hello .. i was wondering if any body can send me the code for alarme with pcf8563 ! thnx