|
CTS-SAT-1-OBC-Firmware
|
#include "gnss_receiver/gnss_internal_drivers.h"#include "timekeeping/timekeeping.h"#include "log/log.h"#include "uart_handler/uart_handler.h"#include <stdio.h>#include <time.h>#include <stdint.h>#include <string.h>#include "main.h"
Functions | |
| uint8_t | GNSS_parse_timea_response_and_convert_to_unix_time_ms (char *input_str, uint64_t *unix_time_ms) |
| Parses a GNSS receiver TIMEA message and converts it into Unix epoch time in milliseconds. | |
| uint8_t | GNSS_set_obc_time_based_on_gnss_time_uart () |
| Sets the OBC's time, based on the GNSS receiver's current time. | |
| static uint8_t | GNSS_get_pps_pin_state () |
| Get the state of the GNSS PPS pin. | |
| uint8_t | GNSS_set_obc_time_based_on_gnss_pps () |
| Modify the already-synced OBC time to move the time by up to 499ms to align with the GNSS PPS. | |
|
inlinestatic |
Get the state of the GNSS PPS pin.

| uint8_t GNSS_parse_timea_response_and_convert_to_unix_time_ms | ( | char * | input_str, |
| uint64_t * | unix_time_ms ) |
Parses a GNSS receiver TIMEA message and converts it into Unix epoch time in milliseconds.
The function expects a full TIMEA log string as input (e.g., starting with "#TIMEA,..."). It tokenizes the string, extracts UTC date and time fields, validates their integrity, and converts them to a Unix timestamp in milliseconds.
| input_str | The GNSS response string (e.g., from a TIMEA log). |

| uint8_t GNSS_set_obc_time_based_on_gnss_pps | ( | ) |
Modify the already-synced OBC time to move the time by up to 499ms to align with the GNSS PPS.


| uint8_t GNSS_set_obc_time_based_on_gnss_time_uart | ( | ) |
Sets the OBC's time, based on the GNSS receiver's current time.
This function sends a command to the GNSS receiver to fetch the current time, parses the TIMEA response to extract UTC time, converts it to Unix epoch time, and sets the system clock accordingly.

