v1.7.31 (clockcontroller deeply reworked)

This commit is contained in:
Klaus K Wilting committed 2019-02-17 19:21:08 +01:00
1 parent c8978a0745
commit 05a3f3b2a8
18 files changed
+271 -240

No files matched your search

+1
View File
@@ -11,5 +11,6 @@
void clock_init(void);
void clock_loop(void *pvParameters);
time_t telegram_time(void);
#endif // _CLOCKCONTROLLER_H
+2 -3
View File
@@ -5,15 +5,14 @@
#include "senddata.h"
#include "rcommand.h"
#include "spislave.h"
#include "rtctime.h"
#include <lmic.h>
#ifdef HAS_BME
#include "bme680mems.h"
#endif
#ifdef HAS_RTC
#include "rtctime.h"
#endif
void doHousekeeping(void);
uint64_t uptime(void);
+7 -2
View File
@@ -3,11 +3,16 @@
#include "globals.h"
#define DCF77_FRAME_SIZE (60)
#define DCF77_PULSE_LENGTH (100)
extern uint8_t DCFpulse[];
enum dcf_pulses { dcf_off, dcf_zero, dcf_one };
enum dcf_pinstate { dcf_low, dcf_high };
void DCF_Pulse(time_t startTime);
void DCF77_Frame(time_t t);
void DCF_Pulse(time_t t);
void IRAM_ATTR DCF77_Frame(time_t t);
void set_DCF77_pin(dcf_pinstate state);
uint8_t dec2bcd(uint8_t dec, uint8_t startpos, uint8_t endpos, uint8_t pArray[]);
+6 -14
View File
@@ -45,13 +45,6 @@
pdTRUE
#define I2C_MUTEX_UNLOCK() xSemaphoreGive(I2Caccess)
// Clock controller settings
#define PPS (1000) // on board time pulse frequency in ms
#define IF482_FRAME_SIZE (17)
#define IF482_PULSE_LENGTH (1000)
#define DCF77_FRAME_SIZE (60)
#define DCF77_PULSE_LENGTH (100)
// Struct holding devices's runtime configuration
typedef struct {
uint8_t lorasf; // 7-12, lora spreadfactor
@@ -104,20 +97,19 @@ typedef struct {
enum sendprio_t { prio_low, prio_normal, prio_high };
// global variables
extern std::set<uint16_t, std::less<uint16_t>, Mallocator<uint16_t>> macs;
extern std::array<uint64_t, 0xff>::iterator it;
extern std::array<uint64_t, 0xff> beacons;
extern configData_t cfg; // current device configuration
extern char display_line6[], display_line7[]; // screen buffers
extern uint8_t volatile channel; // wifi channel rotation counter
extern uint16_t volatile macs_total, macs_wifi, macs_ble,
batt_voltage; // display values
extern bool volatile TimePulseTick;
extern hw_timer_t *sendCycle, *displaytimer;
extern SemaphoreHandle_t I2Caccess, TimePulse;
extern std::set<uint16_t, std::less<uint16_t>, Mallocator<uint16_t>> macs;
extern std::array<uint64_t, 0xff>::iterator it;
extern std::array<uint64_t, 0xff> beacons;
extern TaskHandle_t irqHandlerTask;
extern TaskHandle_t irqHandlerTask, ClockTask;
extern TimerHandle_t WifiChanTimer;
extern Timezone myTZ;
+4 -1
View File
@@ -3,10 +3,13 @@
#include "globals.h"
#define IF482_FRAME_SIZE (17)
#define IF482_PULSE_LENGTH (1000)
extern HardwareSerial IF482;
void IF482_Pulse(time_t t);
String IF482_Frame(time_t tt);
String IRAM_ATTR IF482_Frame(time_t tt);
TickType_t tx_Ticks(unsigned long baud, uint32_t config, int8_t rxPin,
int8_t txPins);
+2 -4
View File
@@ -10,16 +10,14 @@
#include <SPI.h>
#include <arduino_lmic_hal_boards.h>
#include "loraconf.h"
#include "rtctime.h"
// Needed for 24AA02E64, does not hurt anything if included and not used
#ifdef MCP_24AA02E64_I2C_ADDRESS
#include <Wire.h>
#endif
// Needed for RTC time sync if RTC present on board
#ifdef HAS_RTC
#include "rtctime.h"
#endif
extern QueueHandle_t LoraSendQueue;
+1
View File
@@ -17,5 +17,6 @@
#include "led.h"
#include "spislave.h"
#include "lorawan.h"
#include "rtctime.h"
#include "clockcontroller.h"
#endif
+3 -6
View File
@@ -11,20 +11,17 @@
extern RtcDS3231<TwoWire> Rtc; // make RTC instance globally available
extern TaskHandle_t ClockTask;
extern hw_timer_t *clockCycle;
extern bool volatile TimePulseTick;
int rtc_init(void);
int set_rtctime(uint32_t t);
int set_rtctime(time_t t);
void sync_rtctime(void);
time_t get_rtctime(void);
float get_rtctemp(void);
void IRAM_ATTR CLOCKIRQ();
void IRAM_ATTR CLOCKIRQ(void);
int timepulse_init(void);
void timepulse_start();
void timepulse_start(void);
int sync_TimePulse(void);
int sync_SysTime(time_t);
int sync_SysTime(uint32_t t);
#endif // _RTCTIME_H