31 lines
739 B
C
31 lines
739 B
C
#pragma once
|
|
#include "driver/gpio.h"
|
|
#include "driver/uart.h"
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <time.h>
|
|
|
|
typedef struct {
|
|
uart_port_t uart_port;
|
|
gpio_num_t tx_pin;
|
|
gpio_num_t rx_pin;
|
|
gpio_num_t pps_pin;
|
|
} gps_sync_config_t;
|
|
|
|
typedef struct {
|
|
int64_t monotonic_us;
|
|
int64_t monotonic_ms;
|
|
int64_t gps_us;
|
|
int64_t gps_ms;
|
|
struct timespec mono_ts;
|
|
bool synced;
|
|
} gps_timestamp_t;
|
|
|
|
void gps_sync_init(const gps_sync_config_t *config, bool use_gps_log_timestamps);
|
|
void gps_force_next_update(void);
|
|
gps_timestamp_t gps_get_timestamp(void);
|
|
int64_t gps_get_monotonic_ms(void);
|
|
bool gps_is_synced(void);
|
|
uint32_t gps_log_timestamp(void);
|
|
int gps_log_vprintf(const char *fmt, va_list args);
|