#include <IEEE1588Timer.h>
IEEE1588Timer class - Encapsulates 1588 timer functionality for GPS PPS synchronization
This class manages the hardware 1588 timer on the ethernet controller for precise time synchronization with GPS PPS signals. It provides methods to:
- Initialize the 1588 timer hardware
- Capture PPS edges with precise timestamps
- Track GPS time synchronization validity
- Calculate precise NTP timestamps
◆ enablePPSCapture()
void IEEE1588Timer::enablePPSCapture |
( |
| ) |
|
Enable PPS capture on channel 2 Configures interrupt handling for PPS edge detection
◆ getConsecutiveValidSeconds()
uint32_t IEEE1588Timer::getConsecutiveValidSeconds |
( |
| ) |
const |
|
inline |
Get count of consecutive valid GPS seconds
- Returns
- Number of consecutive seconds with valid GPS time
◆ getCurrentTime()
uint32_t IEEE1588Timer::getCurrentTime |
( |
EthernetVars & | ev | ) |
|
Get current 1588 timer value
- Parameters
-
ev | Reference to ethernet variables structure |
- Returns
- Current 1588 timer count
◆ getPPSCapture()
uint32_t IEEE1588Timer::getPPSCapture |
( |
uint8_t | index | ) |
const |
|
inline |
Access PPS capture arrays for timestamp calculation These methods provide read-only access to internal arrays for use by NtpTimeStamp::SetFrom method
◆ getPPSLoop()
uint32_t IEEE1588Timer::getPPSLoop |
( |
| ) |
const |
|
inline |
Get current PPS loop index
- Returns
- Current ring buffer write index
◆ init()
bool IEEE1588Timer::init |
( |
| ) |
|
Initialize the 1588 timer hardware Sets up the timer with proper clock source and enables PPS capture
- Returns
- true if initialization successful, false on error
◆ markValidTime()
void IEEE1588Timer::markValidTime |
( |
uint8_t | index, |
|
|
uint32_t | ntpTime ) |
Mark a GPS time as valid for a specific PPS capture Called by GPS processing when GPRMC message provides valid time
- Parameters
-
index | Ring buffer index for the PPS capture |
ntpTime | NTP timestamp corresponding to this PPS |
◆ PPS_1588_TimeCapIsr()
void IEEE1588Timer::PPS_1588_TimeCapIsr |
( |
| ) |
|
|
static |
Static ISR handler for PPS capture interrupt This must be static to be used as C-style function pointer
◆ resetConsecutiveSeconds()
void IEEE1588Timer::resetConsecutiveSeconds |
( |
| ) |
|
|
inline |
Reset consecutive seconds tracking Called when GPS synchronization is lost
◆ ring_diff_forward()
static uint32_t IEEE1588Timer::ring_diff_forward |
( |
uint32_t | a, |
|
|
uint32_t | b ) |
|
inlinestatic |
Utility functions for ring buffer arithmetic These are used for calculating time differences in wrap-around scenarios
◆ updateConsecutiveSeconds()
void IEEE1588Timer::updateConsecutiveSeconds |
( |
uint32_t | currentTimeTick | ) |
|
Update consecutive seconds tracking Called when new valid GPS time is received
- Parameters
-
currentTimeTick | Current OS tick count |
The documentation for this class was generated from the following files: