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.
DS3231.h
00001 #ifndef DS3231_H 00002 #define DS3231_H 00003 00004 #define TRUE 1 00005 #define FALSE 0 00006 00007 #define SINGLE_BYTE 1 00008 00009 #define DS3231_ADDRESS 0x68<<1/*0xAE*/ 00010 00011 #define SECONDS 0x00 00012 #define MINUTES 0x01 00013 #define HOURS 0x02 00014 #define DAY 0x03 00015 #define DATE 0x04 00016 #define MONTH_CENTURY 0x05 00017 #define YEAR 0x06 00018 00019 #define ALARM_1_SECONDS 0x07 00020 #define ALARM_1_MINUTES 0x08 00021 #define ALARM_1_HOURS 0x09 00022 #define ALARM_1_DAY_DATE 0x0A 00023 #define ALARM_2_MINUTES 0x0B 00024 #define ALARM_2_HOURS 0x0C 00025 #define ALARM_2_DAY_DATE 0x0D 00026 00027 #define CONTROL 0x0E 00028 #define CONTROL_STATUS 0x0F 00029 00030 #define AGING_OFFSET 0x10 00031 00032 #define MSB_OF_TEMP 0x11 00033 #define LSB_OF_TEMP 0x12 00034 00035 00036 00037 class DS3231 00038 { 00039 public: 00040 DS3231(PinName sda, PinName scl); 00041 void readControl(); 00042 private: 00043 int readByte(uint8_t registerAddress); 00044 int *readBytes(uint8_t registerAddress,uint8_t numBytes); 00045 int writeByte(uint8_t registerAddress,uint8_t outBuffer); 00046 // int writeBytes(uint8_t registerAddress, uint8_t *outBuffer,uint8_t numBytes); 00047 00048 protected: 00049 00050 I2C *_DS3231; 00051 00052 00053 }; 00054 00055 #endif
Generated on Wed Jul 13 2022 02:56:39 by
1.7.2