M41T62 is a serial real-time clock (RTC) made by STMicroelectronics.
Dependents: LPC1114_data_logger Check_external_RTC LPC1114_barometer_with_data_logging
Diff: m41t62_rtc.cpp
- Revision:
- 4:0c07690cb24f
- Parent:
- 3:41c351da2fdf
- Child:
- 5:959683e91979
--- a/m41t62_rtc.cpp Sun Feb 22 01:08:24 2015 +0000 +++ b/m41t62_rtc.cpp Wed Aug 23 09:26:41 2017 +0000 @@ -2,17 +2,11 @@ * mbed library program * Control M41T62 RTC Module * - * Copyright (c) 2014,'15 Kenji Arai / JH1PJL + * Copyright (c) 2014,'15,'17 Kenji Arai / JH1PJL * http://www.page.sannet.ne.jp/kenjia/index.html * http://mbed.org/users/kenjiArai/ - * Created: June 21st, 2014 - * Revised: Feburary 22nd, 2015 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * Created: June 21st, 2014 + * Revised: August 23rd, 2017 */ /* *---------------- REFERENCE ---------------------------------------------------------------------- @@ -23,13 +17,15 @@ #include "mbed.h" #include "m41t62_rtc.h" -M41T62::M41T62 (PinName p_sda, PinName p_scl) : _i2c(p_sda, p_scl) +M41T62::M41T62 (PinName p_sda, PinName p_scl) + : _i2c_p(new I2C(p_sda, p_scl)), _i2c(*_i2c_p) { M41T62_addr = M41T62ADDR; _i2c.frequency(100000); } -M41T62::M41T62 (I2C& p_i2c) : _i2c(p_i2c) +M41T62::M41T62 (I2C& p_i2c) + : _i2c(p_i2c) { M41T62_addr = M41T62ADDR; _i2c.frequency(100000); @@ -158,3 +154,5 @@ tmp = ((uint8_t)(dt & (uint8_t)0xf0) >> (uint8_t)0x4) * 10; return (tmp + (dt & (uint8_t)0x0f)); } + +