Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

01.00.09 - Timer bug update #8

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/akkoyun/RV3028) ![arduino-library-badge](https://www.ardu-badge.com/badge/RV3028.svg?) ![Visits Badge](https://badges.pufler.dev/visits/akkoyun/RV3028) ![GitHub stars](https://img.shields.io/github/stars/akkoyun/RV3028?style=flat&logo=github) ![Updated Badge](https://badges.pufler.dev/updated/akkoyun/RV3028) ![PlatformIO Registry](https://badges.registry.platformio.org/packages/akkoyun/library/RV3028.svg)
[![Check Arduino](https://github.com/akkoyun/RV3028/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/akkoyun/RV3028/actions/workflows/check-arduino.yml) [![Compile Examples](https://github.com/akkoyun/RV3028/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/akkoyun/RV3028/actions/workflows/compile-examples.yml) [![Spell Check](https://github.com/akkoyun/RV3028/actions/workflows/spell-check.yml/badge.svg)](https://github.com/akkoyun/RV3028/actions/workflows/spell-check.yml)

Build - 01.00.08
Build - 01.00.09

---

Expand Down
5 changes: 4 additions & 1 deletion examples/RTC_Timer/RTC_Timer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ void setup() {
Serial.println(" RTC Functions ");
Serial.println("--------------------------");

// Set I2C Multiplexer
I2C.Set_Multiplexer(I2C.TCA9548.I2C_Address ,1);

// Start RTC
RTC.Begin();

Expand Down Expand Up @@ -41,7 +44,7 @@ void loop() {
Serial.println(RTC.Time_Stamp());

// Set Timer
RTC.Set_Timer(false, 1, 10, true, true, true);
RTC.Set_Timer(false, 1, 10, true, true, true);

// Set Variable
RTC_Interrupt = false;
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RV3028",
"version": "1.0.8",
"version": "1.0.9",
"keywords": "RV3028, RTC, Timer, UNIX, Clock, Alarm, Calendar, Counter, I2C",
"description": "Basic library for the RV-3028-C7 RTC",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=RV3028
version=1.0.8
version=1.0.9
author=Gunce Akkoyun <akkoyun@me.com>
maintainer=Gunce Akkoyun <akkoyun@me.com>
sentence=Basic library for the RV-3028-C7 RTC
Expand Down
76 changes: 11 additions & 65 deletions src/RV3028.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ String RV3028::Time_Stamp(void) {
char _Time_Stamp[25]; // dd-mm-yyyy hh.mm.ss

// Handle TimeStamp
sprintf(_Time_Stamp, "%02hhu-%02hhu-%02hhu %02hhu:%02hhu:%02hhu", Get_Date(), Get_Month(), Get_Year(), Get_Hour(), Get_Minute(), Get_Second());
sprintf(_Time_Stamp, "%02hhu-%02hhu-%02hhu %02hhu:%02hhu:%02hhu", Get_Year(), Get_Month(), Get_Date(), Get_Hour(), Get_Minute(), Get_Second());

// End Function
return(_Time_Stamp);
Expand Down Expand Up @@ -115,71 +115,17 @@ uint16_t RV3028::Get_Year(void) {
// Set Time Variables
void RV3028::Set_Time(uint8_t _Second, uint8_t _Minute, uint8_t _Hour, uint8_t _Date, uint8_t _Month, uint8_t _Year) {

// Set Year
Set_Year(_Year);

// Set Month
Set_Month(_Month);

// Set Day
Set_Date(_Date);

// Calculate Day of Week
uint8_t _DayofWeek = Day_of_Week(_Date, _Month, _Year);

// Set Day of Week
Set_Week_Day(_DayofWeek);

// Set Hour
Set_Hour(_Hour);

// Set Minute
Set_Minute(_Minute);

// Set Second
Set_Second(_Second);

}
void RV3028::Set_Second(uint8_t _Second) {

// Write Register
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Seconds__, I2C.DECtoBCD(_Second), true);

}
void RV3028::Set_Minute(uint8_t _Minute) {

// Write Register
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Minutes__, I2C.DECtoBCD(_Minute), true);

}
void RV3028::Set_Hour(uint8_t _Hour) {

// Write Register
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Hours__, I2C.DECtoBCD(_Hour), true);

}
void RV3028::Set_Week_Day(uint8_t _Week_Day) {

// Write Register
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Week_Day__, I2C.DECtoBCD(_Week_Day), true);

}
void RV3028::Set_Date(uint8_t _Date) {

// Write Register
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Date__, I2C.DECtoBCD(_Date), true);

}
void RV3028::Set_Month(uint8_t _Month) {

// Write Register
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Month__, I2C.DECtoBCD(_Month), true);

}
void RV3028::Set_Year(uint8_t _Year) {

// Write Register
// Set Time
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Year__, I2C.DECtoBCD(_Year), true);
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Month__, I2C.DECtoBCD(_Month), true);
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Date__, I2C.DECtoBCD(_Date), true);
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Week_Day__, I2C.DECtoBCD(_DayofWeek), true);
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Hours__, I2C.DECtoBCD(_Hour), true);
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Minutes__, I2C.DECtoBCD(_Minute), true);
I2C.Write_Register(I2C.RV3028C7.I2C_Address, __RV3028_Seconds__, I2C.DECtoBCD(_Second), true);

}

Expand Down Expand Up @@ -303,13 +249,13 @@ void RV3028::Clear_Interrupt(void) {
void RV3028::Enable_Interrupt(void) {

// Reset Register
I2C.Set_Register_Bit(I2C.RV3028C7.I2C_Address, __RV3028_Status__, 4, true);
I2C.Set_Register_Bit(I2C.RV3028C7.I2C_Address, __RV3028_Control2__, 4, true);

}
void RV3028::Disable_Interrupt(void) {

// Reset Register
I2C.Clear_Register_Bit(I2C.RV3028C7.I2C_Address, __RV3028_Status__, 4, true);
I2C.Clear_Register_Bit(I2C.RV3028C7.I2C_Address, __RV3028_Control2__, 4, true);

}
void RV3028::Read_Timer_Interrupt_Flag(void) {
Expand Down Expand Up @@ -393,7 +339,7 @@ void RV3028::Set_Timer(bool _Repeat, uint16_t _Frequency, uint16_t _Value, bool

// Clock Out
if (_Clock_Output) I2C.Set_Register_Bit(I2C.RV3028C7.I2C_Address, __RV3028_INT_Mask__, 1, true);
if (_Clock_Output) I2C.Clear_Register_Bit(I2C.RV3028C7.I2C_Address, __RV3028_INT_Mask__, 1, true);
if (!_Clock_Output) I2C.Clear_Register_Bit(I2C.RV3028C7.I2C_Address, __RV3028_INT_Mask__, 1, true);

}

Expand Down
7 changes: 0 additions & 7 deletions src/RV3028.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ class RV3028 {

// Get Time Functions
void Set_Time(uint8_t _Second, uint8_t _Minute, uint8_t _Hour, uint8_t _Date, uint8_t _Month, uint8_t _Year);
void Set_Second(uint8_t _Second);
void Set_Minute(uint8_t _Minute);
void Set_Hour(uint8_t _Hour);
void Set_Week_Day(uint8_t _Week_Day);
void Set_Date(uint8_t _Date);
void Set_Month(uint8_t _Month);
void Set_Year(uint8_t _Year);

// UNIX Time Functions
void Clear_UNIX_Time(void);
Expand Down