Merge pull request #3756 from opentx/projectkk2glider/gps_clock_to_rtc_improvements

Projectkk2glider/gps clock to rtc improvements
This commit is contained in:
Bertrand Songis
2016-09-05 19:44:09 +02:00
committed by GitHub
12 changed files with 264 additions and 256 deletions
@@ -20,8 +20,10 @@
#include "opentx.h"
void rtcSetTime(struct gtm * t)
void rtcSetTime(const struct gtm * t)
{
g_ms100 = 0; // start of next second begins now
RTC_TimeTypeDef RTC_TimeStruct;
RTC_DateTypeDef RTC_DateStruct;
+1 -2
View File
@@ -263,9 +263,8 @@ void rtcGetTime(struct gtm * utm)
utm->tm_wday = rtc.wday - 1;
}
void rtcSetTime(struct gtm * t)
void rtcSetTime(const struct gtm * t)
{
g_rtcTime = gmktime(t); // update local timestamp and get wday calculated
g_ms100 = 0; // start of next second begins now
RTC rtc;
+5
View File
@@ -236,3 +236,8 @@ ISR(INT3_vect) // Arduino2560 IO18 (portD pin3)
#endif
}
// RTC driver
void rtcSetTime(const struct gtm * tm)
{
}
+1 -2
View File
@@ -236,9 +236,8 @@ struct t_i2cTime
uint8_t Time[7] ;
} I2CTime ;
void rtcSetTime(struct gtm * t)
void rtcSetTime(const struct gtm * t)
{
g_rtcTime = gmktime(t); // update local timestamp and get wday calculated
g_ms100 = 0; // start of next second begins now
I2CTime.setCode = 0x74 ; // Tiny SET TIME CODE command
@@ -42,9 +42,8 @@ void readRtc()
g_rtcTime = gmktime(&utm);
}
void writeRtc(gtm* ptr)
void writeRtc(const gtm* ptr)
{
g_rtcTime = gmktime(ptr);
g_ms100 = 0; // start of next second begins now
uint8_t buffer[7];
uint8_t read_buffer[7];
@@ -60,7 +59,7 @@ void writeRtc(gtm* ptr)
i2cWriteBuffer(DS3231_I2C_ADDR, read_buffer, 1, buffer, 7);
}
void rtcSetTime(struct gtm * t)
void rtcSetTime(const struct gtm * t)
{
writeRtc(t);
}