WIP
адаптация. в Serial выводятся PPS/SQW и на LCD печатается время
This commit is contained in:
@@ -10,20 +10,23 @@
|
||||
#include <TimeLib.h> // https://github.com/PaulStoffregen/Time [valid until year 2099, no 2038 bug]
|
||||
#include "RTC_com.h"
|
||||
|
||||
#define cfg_pin_RTC_SQW 3;
|
||||
|
||||
// add the static modifier to limit visibility of these variables to just this file
|
||||
static int ledPin_PPS = A6; // Pin for RTC PseudoPPS LED [analog PIN used as digital PIN]
|
||||
static int ledPin_Sync = A7; // Pin for valid RTC Sync
|
||||
static byte RTC_1HZ_PIN = 3; // Pin 3 = NANO INT1, RTC provides a 1Hz interrupt signal on this Pin
|
||||
static byte RTC_1HZ_PIN = cfg_pin_RTC_SQW; // Pin 3 = NANO INT1, RTC provides a 1Hz interrupt signal on this Pin
|
||||
static time_t last_sync_t = 0; // last sync
|
||||
static byte sync_err_hours = 4; // set to 4 for DS3231M, may be set to 8 for DS3231SN. Warning if no GPS sync after n hours, possible 0.1 sec error.
|
||||
bool SyncErr = true;
|
||||
|
||||
#include <DS3232RTC.h>
|
||||
DS3232RTC myRTC;
|
||||
DS3232RTC myRTC(0x68); // cfg_
|
||||
volatile bool RTC_sec = false; // flag for PseudoPPS
|
||||
static unsigned long RTCMillis; // blinking timer
|
||||
|
||||
void rtc_interrupt() {
|
||||
Serial.println("DEBUG[INT] RTC interrupt");
|
||||
RTCMillis = millis();
|
||||
RTC_sec = true;
|
||||
}
|
||||
@@ -44,6 +47,7 @@ void RTC_setup() {
|
||||
}
|
||||
|
||||
void RTC_loop() {
|
||||
//Serial.println("DEBUG[RTC_loop()] Start");
|
||||
if (RTC_sec) { // do after RTC PseudoPPS interrupt, without interrupt NO time/date to display
|
||||
RTC_sec = false; // clear flag
|
||||
digitalWrite(ledPin_PPS, LOW); // LED off
|
||||
|
||||
Reference in New Issue
Block a user