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.
RTC8563.cpp
00001 // 00002 // @ Project : RTC Date Time Clock 00003 // @ File Name : RTC8563.cpp 00004 // @ Date : 06.04.2015 00005 // @ Author : Daniel Hevesy 00006 // @ Copyright : daniel.hevesy-szetty@bulme.at 00007 // 00008 00009 #include "mbed.h" 00010 #include "const.h" 00011 00012 #include "RTC8563.h" 00013 00014 RTC8563::RTC8563() : i2c(p28, p27) // delete void and add call to base constructor 00015 { 00016 // Initialise I2C 00017 i2c.frequency(40000); 00018 char init1[2] = {0x6, 0x00}; 00019 char init2[2] = {0x7, 0xff}; 00020 i2c.write(0x40, init1, 2); 00021 i2c.write(0x40, init2, 2); 00022 } 00023 00024 RTC8563::RTC8563(PinName sda, PinName scl) : i2c(sda, scl) 00025 { 00026 // Initialise I2C 00027 i2c.frequency(40000); 00028 char init1[2] = {0x6, 0x00}; 00029 char init2[2] = {0x7, 0xff}; 00030 i2c.write(0x40, init1, 2); 00031 i2c.write(0x40, init2, 2); 00032 } 00033 00034 char RTC8563::rtc_read(char address) 00035 { 00036 char value; 00037 i2c.start(); 00038 i2c.write(RTC8563_ADR); 00039 i2c.write(address); 00040 i2c.start(); 00041 i2c.write(RTC8563_ADR | _READ); 00042 value = i2c.read(0); 00043 i2c.stop(); 00044 00045 return value; 00046 } 00047 00048 void RTC8563::rtc_write(char address, char value) 00049 { 00050 i2c.start(); 00051 i2c.write(RTC8563_ADR); 00052 i2c.write(address); 00053 i2c.write(value); 00054 i2c.stop(); 00055 } 00056 00057 void RTC8563::rtc_init() 00058 { 00059 } 00060 00061 void RTC8563::rtc_alarm() 00062 { 00063 }
Generated on Wed Aug 3 2022 12:32:56 by
