Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger Check_external_RTC
Diff: RX8025NB.h
- Revision:
- 7:4793c4817590
- Parent:
- 6:414dbeb77add
--- a/RX8025NB.h Tue Dec 17 23:19:54 2019 +0000
+++ b/RX8025NB.h Fri Aug 07 05:38:04 2020 +0000
@@ -3,11 +3,11 @@
* Control RX-8025NB Real Time Clock Module
* EPSON
*
- * Copyright (c) 2015,'16,'17,'19 Kenji Arai / JH1PJL
- * http://www.page.sannet.ne.jp/kenjia/index.html
- * http://mbed.org/users/kenjiArai/
- * Created: June 3rd, 2015
- * Revised: December 17th, 2019
+ * Copyright (c) 2015,'16,'17,'19,'20 Kenji Arai / JH1PJL
+ * http://www7b.biglobe.ne.jp/~kenjia/
+ * https://os.mbed.com/users/kenjiArai/
+ * Created: June 3rd, 2015
+ * Revised: August 7th, 2020
*/
/*
@@ -27,14 +27,6 @@
// 7bit address = 0b0110010(No other choice)
#define RX8025ADDR (0x32 << 1)
-#define RTC_Wk_Sunday ((uint8_t)0x00)
-#define RTC_Wk_Monday ((uint8_t)0x01)
-#define RTC_Wk_Tuesday ((uint8_t)0x02)
-#define RTC_Wk_Wednesday ((uint8_t)0x03)
-#define RTC_Wk_Thursday ((uint8_t)0x04)
-#define RTC_Wk_Friday ((uint8_t)0x05)
-#define RTC_Wk_Saturday ((uint8_t)0x06)
-
// Register definition
#define RX8025_REG_SEC 0x0
#define RX8025_REG_MIN 0x1
@@ -56,12 +48,18 @@
// Buffer size
#define RTC_BUF_SIZ (RX8025_REG_CONTL2 + 5)
+typedef enum {
+ RTC_SQW_NONE = 0,
+ RTC_SQW_32KHZ
+} sq_wave_t;
+
/** Interface for RTC (I2C Interface) EPSON RX8025
*
* Standalone type RTC via I2C interface
*
* @code
* #include "mbed.h"
+ * #include "RX8025NB.h"
*
* // I2C Communication
* RX8025 RX8025(dp5,dp27); // RTC(RX8025) SDA, SCL (Fixed address)
@@ -128,25 +126,27 @@
* @param next time (unit: minutes) from now on minimum = 2 minutes!!
* @return none
*/
- void set_next_alarmD_INTA(uint16_t time);
+ void set_next_alarmD_INTA(uint16_t);
+ void set_next_IRQ(uint16_t);
/** Clear Alarm-D / INTA interrupt
* @param none
* @return none
*/
void clear_alarmD_INTA(void);
+ void clear_IRQ(void);
/** Read one byte from specific register
* @param register address
* @return register data
*/
- uint8_t read_reg_byte(uint8_t reg);
+ uint8_t read_reg_byte(uint8_t);
/** Write one byte into specific register
* @param register address, data
* @return register saved data
*/
- uint8_t write_reg_byte(uint8_t reg, uint8_t data);
+ uint8_t write_reg_byte(uint8_t, uint8_t);
/** Read RTC data with own format
* @param tm (data save area)
@@ -164,7 +164,13 @@
* @param freq.
* @return none
*/
- void frequency(int hz);
+ void frequency(int);
+
+ /** Control FOUT output port (FOE pin must high when 32.768kHz output)
+ * @param output_mode
+ * @return none
+ */
+ void set_sq_wave(sq_wave_t);
protected:
I2C *_i2c_p;
@@ -172,12 +178,13 @@
uint8_t bin2bcd(uint8_t);
uint8_t bcd2bin(uint8_t);
- void set_alarmD_reg (uint16_t time);
+ void set_alarmD_reg (uint16_t);
void init(void);
private:
uint8_t RX8025_addr;
- char rtc_buf[RTC_BUF_SIZ]; // buffer for RTC
+ uint8_t rtc_buf[RTC_BUF_SIZ]; // buffer for RTC
+
};
#endif // RX8025_H