RTC_NXP_Arduino 1.1.1
RTC driver device operation sample code for Arduino
|
#include <RTC_NXP.h>
Public Types | |
enum | reg_num { Control_1 , Control_2 , Control_3 , Control_4 , Control_5 , SR_Reset , _100th_Seconds , Seconds , Minutes , Hours , Days , Weekdays , Months , Years , Second_alarm , Minute_alarm , Hour_alarm , Day_alarm , Weekday_alarm , CLKOUT_ctl , Timestp_ctl1 , Sec_timestp1 , Min_timestp1 , Hour_timestp1 , Day_timestp1 , Mon_timestp1 , Year_timestp1 , Timestp_ctl2 , Sec_timestp2 , Min_timestp2 , Hour_timestp2 , Day_timestp2 , Mon_timestp2 , Year_timestp2 , Timestp_ctl3 , Sec_timestp3 , Min_timestp3 , Hour_timestp3 , Day_timestp3 , Mon_timestp3 , Year_timestp3 , Timestp_ctl4 , Sec_timestp4 , Min_timestp4 , Hour_timestp4 , Day_timestp4 , Mon_timestp4 , Year_timestp4 , Aging_offset , INT_A_MASK1 , INT_A_MASK2 , INT_B_MASK1 , INT_B_MASK2 , Watchdg_tim_ctl , Watchdg_tim_val } |
enum | periodic_int_select { DISABLE , EVERY_SECOND , EVERY_MINUTE } |
enum | timestamp_setting { LAST , FIRST } |
enum | clock_out_frequency { FREQ_32768_HZ , FREQ_16384_HZ , FREQ_8192_HZ , FREQ_4096_HZ , FREQ_2048_HZ , FREQ_1024_HZ , FREQ_1_HZ , FREQ_DISABLE } |
![]() | |
enum | board { NONE , ARDUINO_SHIELD } |
enum | alarm_setting { SECOND , MINUTE , HOUR , DAY , WEEKDAY } |
Public Member Functions | |
PCF2131_base () | |
virtual | ~PCF2131_base () |
void | begin (void) |
bool | oscillator_stop (void) |
time_t | rtc_time (void) |
void | set (struct tm *now_tm) |
void | alarm (alarm_setting digit, int val) |
void | alarm (alarm_setting digit, int val, int int_sel) |
void | alarm_clear (void) |
void | alarm_disable (void) |
void | timestamp (int num, timestamp_setting ts_setting, int int_sel=0) |
time_t | timestamp (int num) |
uint8_t | int_clear (void) |
uint8_t | int_clear (uint8_t *state_p) |
void | periodic_interrupt_enable (periodic_int_select sel, int int_sel=0) |
void | set_clock_out (clock_out_frequency freq) |
void | reset () |
void | otp_refresh () |
![]() | |
RTC_NXP () | |
virtual | ~RTC_NXP () |
time_t | time (time_t *tp) |
Protected Member Functions | |
virtual void | _reg_w (uint8_t reg, uint8_t *vp, int len)=0 |
virtual void | _reg_r (uint8_t reg, uint8_t *vp, int len)=0 |
virtual void | _reg_w (uint8_t reg, uint8_t val)=0 |
virtual uint8_t | _reg_r (uint8_t reg)=0 |
virtual void | _bit_op8 (uint8_t reg, uint8_t mask, uint8_t val)=0 |
![]() |
Additional Inherited Members | |
![]() | |
static uint8_t | bcd2dec (uint8_t v) |
static uint8_t | dec2bcd (uint8_t v) |
PCF2131_base class
A base class for PCF2131 Implementing register operation with abstracted interface
PCF2131_base::PCF2131_base | ( | ) |
Constructor
Definition at line 3 of file PCF2131_base.cpp.
|
virtual |
Destructor
Definition at line 7 of file PCF2131_base.cpp.
|
protectedpure virtual |
Proxy method for interface (pure virtual method)
Referenced by alarm(), alarm_clear(), alarm_disable(), otp_refresh(), periodic_interrupt_enable(), set(), set_clock_out(), and timestamp().
|
protectedpure virtual |
Proxy method for interface (pure virtual method)
|
protectedpure virtual |
Proxy method for interface (pure virtual method)
Referenced by int_clear(), oscillator_stop(), rtc_time(), and timestamp().
|
protectedpure virtual |
Proxy method for interface (pure virtual method)
Referenced by alarm(), int_clear(), reset(), and set().
|
protectedpure virtual |
Proxy method for interface (pure virtual method)
|
virtual |
Alarm setting
digit | to specify which parameter to set: SECOND, MINUTE, HOUR, DAY, WEEKDAY in 'enum alarm_setting' |
val | Setting value. Set 0x80 to disabling |
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 68 of file PCF2131_base.cpp.
Referenced by alarm().
void PCF2131_base::alarm | ( | alarm_setting | digit, |
int | val, | ||
int | int_sel ) |
Alarm setting
digit | to specify which parameter to set: SECOND, MINUTE, HOUR, DAY, WEEKDAY in 'enum alarm_setting' |
val | Setting value. Set 0x80 to disabling |
int_sel | Interrupt output selector. ) for INT_A, 1 for INT_B |
Definition at line 73 of file PCF2131_base.cpp.
|
virtual |
Alarm interrupt disable
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 81 of file PCF2131_base.cpp.
|
virtual |
Interrupt clear
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 86 of file PCF2131_base.cpp.
|
virtual |
Initializer Clears penginf interrupt
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 11 of file PCF2131_base.cpp.
uint8_t PCF2131_base::int_clear | ( | uint8_t * | state_p | ) |
Interrupt clear
Definition at line 139 of file PCF2131_base.cpp.
|
virtual |
Interrupt clear
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 131 of file PCF2131_base.cpp.
Referenced by begin(), and int_clear().
|
virtual |
Detector for oscillation stop
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 17 of file PCF2131_base.cpp.
void PCF2131_base::otp_refresh | ( | ) |
Perform OTP refresh (loads factory-provided calibration data stored in EPROM)
Definition at line 180 of file PCF2131_base.cpp.
void PCF2131_base::periodic_interrupt_enable | ( | periodic_int_select | sel, |
int | int_sel = 0 ) |
Enabling every second/minute interrupt
sel | choose DISABLE, EVERY_SECOND or EVERY_MINUTE in 'enum periodic_int_select' |
int_sel | Interrupt output selector. ) for INT_A, 1 for INT_B |
Definition at line 155 of file PCF2131_base.cpp.
void PCF2131_base::reset | ( | ) |
Trigger software reset
Definition at line 175 of file PCF2131_base.cpp.
|
virtual |
time
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 22 of file PCF2131_base.cpp.
|
virtual |
set
now_tm | struct to set calendar and time in RTC |
Implements RTC_NXP.
Reimplemented in PCF2131_I2C, and PCF2131_SPI.
Definition at line 41 of file PCF2131_base.cpp.
void PCF2131_base::set_clock_out | ( | clock_out_frequency | freq | ) |
Set clock output (CLKOUT)
freq | choose desired clock output (CLKOUT) frequency in 'enum clock_out_frequency' |
Definition at line 170 of file PCF2131_base.cpp.
time_t PCF2131_base::timestamp | ( | int | num | ) |
Getting timestamp info
num | timestamp number: 1~4 |
Definition at line 106 of file PCF2131_base.cpp.
void PCF2131_base::timestamp | ( | int | num, |
timestamp_setting | ts_setting, | ||
int | int_sel = 0 ) |
Timestamp setting
num | timestamp number: 1~4 |
ts_setting | event recording option. Choose LAST or FIRST in 'enum timestamp_setting' |
int_sel | Interrupt output selector. ) for INT_A, 1 for INT_B |
Definition at line 91 of file PCF2131_base.cpp.