RX-8025NB Real Time Clock Module by EPSON

Dependents:   TYBLE16_simple_data_logger Check_external_RTC

Embed: (wiki syntax)

« Back to documentation index

RX8025 Class Reference

RX8025 Class Reference

Interface for RTC (I2C Interface) EPSON RX8025. More...

#include <RX8025NB.h>

Public Member Functions

 RX8025 (PinName p_sda, PinName p_scl)
 Configure data pin (with other devices on I2C line)
 RX8025 (I2C &p_i2c)
 Configure data pin (with other devices on I2C line)
void read_rtc_std (tm *)
 Read RTC data with Standard C "struct tm" format.
void write_rtc_std (tm *)
 Write data to RTC data with Standard C "struct tm" format.
void set_next_alarmD_INTA (uint16_t)
 Set Alarm-D / INTA time.
void clear_alarmD_INTA (void)
 Clear Alarm-D / INTA interrupt.
uint8_t read_reg_byte (uint8_t)
 Read one byte from specific register.
uint8_t write_reg_byte (uint8_t, uint8_t)
 Write one byte into specific register.
void read_rtc_direct (rtc_time *)
 Read RTC data with own format.
void write_rtc_direct (rtc_time *)
 Read RTC data with own format.
void frequency (int)
 Set I2C clock frequency.
void set_sq_wave (sq_wave_t)
 Control FOUT output port (FOE pin must high when 32.768kHz output)

Detailed Description

Interface for RTC (I2C Interface) EPSON RX8025.

Standalone type RTC via I2C interface

 #include "mbed.h"
 #include "RX8025NB.h"

 // I2C Communication
  RX8025     RX8025(dp5,dp27); // RTC(RX8025) SDA, SCL (Fixed address)
 // If you connected I2C line not only this device but also other devices,
 //     you need to declare following method.
  I2C        i2c(dp5,dp27);    // SDA, SCL
  RX8025     RX8025(i2c);      // RTC(RX8025) (Fixed address)

 int main() {
 tm t;
 time_t seconds;
 char buf[40];

   while(1){
      RX8025.get_time_rtc(&t);   // read RTC data
      seconds = mktime(&t);
      strftime(buf, 40, "%I:%M:%S %p (%Y/%m/%d)", localtime(&seconds));
      printf("Date: %s\r\n", buf);
   }
 }

Definition at line 86 of file RX8025NB.h.


Constructor & Destructor Documentation

RX8025 ( PinName  p_sda,
PinName  p_scl 
)

Configure data pin (with other devices on I2C line)

Parameters:
dataSDA and SCL pins

Definition at line 18 of file RX8025NB.cpp.

RX8025 ( I2C &  p_i2c )

Configure data pin (with other devices on I2C line)

Parameters:
I2Cprevious definition

Definition at line 25 of file RX8025NB.cpp.


Member Function Documentation

void clear_alarmD_INTA ( void   )

Clear Alarm-D / INTA interrupt.

Parameters:
none
Returns:
none

Definition at line 173 of file RX8025NB.cpp.

void frequency ( int  hz )

Set I2C clock frequency.

Parameters:
freq.
Returns:
none

Definition at line 205 of file RX8025NB.cpp.

uint8_t read_reg_byte ( uint8_t  reg )

Read one byte from specific register.

Parameters:
registeraddress
Returns:
register data

Definition at line 188 of file RX8025NB.cpp.

void read_rtc_direct ( rtc_time *  tm )

Read RTC data with own format.

Parameters:
tm(data save area)
Returns:
none but all data in tm

Definition at line 211 of file RX8025NB.cpp.

void read_rtc_std ( tm *  t )

Read RTC data with Standard C "struct tm" format.

Parameters:
tm(data save area)
Returns:
none but all data in tm

Definition at line 72 of file RX8025NB.cpp.

void set_next_alarmD_INTA ( uint16_t  time )

Set Alarm-D / INTA time.

Parameters:
nexttime (unit: minutes) from now on minimum = 2 minutes!!
Returns:
none

Definition at line 150 of file RX8025NB.cpp.

void set_sq_wave ( sq_wave_t  sqw_dt )

Control FOUT output port (FOE pin must high when 32.768kHz output)

Parameters:
output_mode
Returns:
none

Definition at line 240 of file RX8025NB.cpp.

uint8_t write_reg_byte ( uint8_t  reg,
uint8_t  data 
)

Write one byte into specific register.

Parameters:
registeraddress, data
Returns:
register saved data

Definition at line 196 of file RX8025NB.cpp.

void write_rtc_direct ( rtc_time *  tm )

Read RTC data with own format.

Parameters:
tm(save writing data)
Returns:
none but all data in tm

Definition at line 226 of file RX8025NB.cpp.

void write_rtc_std ( tm *  t )

Write data to RTC data with Standard C "struct tm" format.

Parameters:
tm(save writing data)
Returns:
none but all data in tm

Definition at line 97 of file RX8025NB.cpp.