aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2019-08-01 02:52:47 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2019-08-01 02:52:47 -0500
commit253d38a786dbed3e09b90399a05943153ca8d457 (patch)
tree765bfcd4a5d40a596bbfb7944c1136a30ea8bf7c
parent452ecb5e9c0ad214cab6617c1a54a2edc55a6cd3 (diff)
Add functions to edit SQWE.
-rwxr-xr-xds3231.c8
-rwxr-xr-xds3231.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/ds3231.c b/ds3231.c
index b70a09b..38d1edd 100755
--- a/ds3231.c
+++ b/ds3231.c
@@ -71,6 +71,14 @@ void Set_DayOfWeek(int dow) {
I2C_Master_Stop();
}
+void Set_Sqwe(int contvalue) {
+ I2C_Master_Start(); // Start I2C
+ I2C_Master_Write(0xD0); // RTC Chip address
+ I2C_Master_Write(0x0E); // Control register address
+ I2C_Master_Write(contvalue); // Data to control register
+ I2C_Master_Stop();
+}
+
void Set_Time() {
I2C_Master_Start(); // Start I2C
I2C_Master_Write(0xD0); // RTC Chip address
diff --git a/ds3231.h b/ds3231.h
index 3131310..ba5bbbc 100755
--- a/ds3231.h
+++ b/ds3231.h
@@ -6,6 +6,7 @@ unsigned int Get_DayOfWeek(unsigned int, unsigned int, unsigned int);
void Read_Alarms_Temp(void);
void Set_Date(void);
void Set_DayOfWeek(int);
+void Set_Sqwe(int);
void Set_Time(void);
void Update_Current_Date_Time(void);
void Write_Alarms(void); \ No newline at end of file