refactored clock controller code
This commit is contained in:
1 parent
91889a2af8
commit
c8978a0745
17 files changed
+199
-254
No files matched your search
@@ -0,0 +1,15 @@
|
||||
#ifndef _CLOCKCONTROLLER_H
|
||||
#define _CLOCKCONTROLLER_H
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef HAS_IF482
|
||||
#include "if482.h"
|
||||
#elif defined HAS_DCF77
|
||||
#include "dcf77.h"
|
||||
#endif
|
||||
|
||||
void clock_init(void);
|
||||
void clock_loop(void *pvParameters);
|
||||
|
||||
#endif // _CLOCKCONTROLLER_H
|
||||
+2
-6
@@ -2,16 +2,12 @@
|
||||
#define _DCF77_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "rtctime.h"
|
||||
|
||||
enum dcf_pulses { dcf_off, dcf_zero, dcf_one };
|
||||
enum dcf_pinstate { dcf_low, dcf_high };
|
||||
|
||||
int dcf77_init(void);
|
||||
void dcf77_loop(void *pvParameters);
|
||||
void sendDCF77(void);
|
||||
void DCF_Out(uint8_t startsec);
|
||||
void generateTimeframe(time_t t);
|
||||
void DCF_Pulse(time_t startTime);
|
||||
void 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[]);
|
||||
|
||||
|
||||
+12
-13
@@ -40,11 +40,17 @@
|
||||
#define SCREEN_MODE (0x80)
|
||||
|
||||
// I2C bus access control
|
||||
#define I2C_MUTEX_LOCK() xSemaphoreTake(I2Caccess, (3 * DISPLAYREFRESH_MS / portTICK_PERIOD_MS)) == pdTRUE
|
||||
#define I2C_MUTEX_UNLOCK() xSemaphoreGive(I2Caccess)
|
||||
#define I2C_MUTEX_LOCK() \
|
||||
xSemaphoreTake(I2Caccess, (3 * DISPLAYREFRESH_MS / portTICK_PERIOD_MS)) == \
|
||||
pdTRUE
|
||||
#define I2C_MUTEX_UNLOCK() xSemaphoreGive(I2Caccess)
|
||||
|
||||
// time pulse frequency 1Hz
|
||||
#define PPS (1000)
|
||||
// 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 {
|
||||
@@ -66,7 +72,8 @@ typedef struct {
|
||||
uint8_t runmode; // 0=normal, 1=update
|
||||
uint8_t payloadmask; // bitswitches for payload data
|
||||
char version[10]; // Firmware version
|
||||
uint8_t bsecstate[BSEC_MAX_STATE_BLOB_SIZE + 1]; // BSEC state for BME680 sensor
|
||||
uint8_t
|
||||
bsecstate[BSEC_MAX_STATE_BLOB_SIZE + 1]; // BSEC state for BME680 sensor
|
||||
} configData_t;
|
||||
|
||||
// Struct holding payload for data send queue
|
||||
@@ -151,12 +158,4 @@ extern Timezone myTZ;
|
||||
#include "bme680mems.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAS_IF482
|
||||
#include "if482.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAS_DCF77
|
||||
#include "dcf77.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+5
-4
@@ -2,11 +2,12 @@
|
||||
#define _IF482_H
|
||||
|
||||
#include "globals.h"
|
||||
#include "rtctime.h"
|
||||
|
||||
int if482_init(void);
|
||||
void if482_loop(void *pvParameters);
|
||||
TickType_t tx_time(unsigned long baud, uint32_t config, int8_t rxPin,
|
||||
extern HardwareSerial IF482;
|
||||
|
||||
void IF482_Pulse(time_t t);
|
||||
String IF482_Frame(time_t tt);
|
||||
TickType_t tx_Ticks(unsigned long baud, uint32_t config, int8_t rxPin,
|
||||
int8_t txPins);
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -17,5 +17,5 @@
|
||||
#include "led.h"
|
||||
#include "spislave.h"
|
||||
#include "lorawan.h"
|
||||
|
||||
#include "clockcontroller.h"
|
||||
#endif
|
||||
+2
-1
@@ -24,6 +24,7 @@ float get_rtctemp(void);
|
||||
void IRAM_ATTR CLOCKIRQ();
|
||||
int timepulse_init(void);
|
||||
void timepulse_start();
|
||||
void sync_clock(void);
|
||||
int sync_TimePulse(void);
|
||||
int sync_SysTime(time_t);
|
||||
|
||||
#endif // _RTCTIME_H
|
||||
Reference in new issue
Block a user