diff --git a/firmware/inc/osp_messages.h b/firmware/inc/osp_messages.h index 09e948a..2f2f35d 100644 --- a/firmware/inc/osp_messages.h +++ b/firmware/inc/osp_messages.h @@ -461,6 +461,34 @@ enum osp_oktosend { } __PACKED__ payload; }; + +/** + * 6.42 OSP 1PPS Time + */ +#define OSP_OUT_1PPS_TIME_ID 52 + struct osp_out_1pps_time { + osp_message_id_t id; + enum osp_packet_state state; + uint16_t max_payload_size; + struct { + uint8_t hour; + uint8_t minute; + uint8_t second; + uint8_t day; + uint8_t month; + uint16_t year; + int16_t utc_offset_int; /* s. gps offset from utc */ + uint32_t utc_offset_frac; /* ns */ + uint8_t status; /* enum osp_1pps_status */ + } __PACKED__ payload; +}; +enum osp_1pps_status { + OSP_1PPS_VALID = (1<<0), + OSP_1PPS_IS_UTCTIME = (1<<1), /* otherwise gps time */ + OSP_1PPS_OFFSET_VALID = (1<<2), +}; + + /** * 6.55 OSP GPIO State */ diff --git a/firmware/src/gps_osp.c b/firmware/src/gps_osp.c index 526d5dd..9dd077d 100644 --- a/firmware/src/gps_osp.c +++ b/firmware/src/gps_osp.c @@ -95,6 +95,11 @@ volatile struct osp_out_geodetic_navigation_data osp_out_geodetic_navigation_dat .state = OSP_PACKET_WAITING, .max_payload_size = sizeof(osp_out_geodetic_navigation_data.payload) }; +volatile struct osp_out_1pps_time osp_out_1pps_time = { + .id = OSP_OUT_1PPS_TIME_ID, + .state = OSP_PACKET_WAITING, + .max_payload_size = sizeof(osp_out_1pps_time.payload) +}; volatile struct osp_out_gpio_state osp_out_gpio_state = { .id = OSP_OUT_GPIO_STATE_ID, .state = OSP_PACKET_WAITING, @@ -125,6 +130,7 @@ volatile osp_message_t* const osp_out_messages[] = { (osp_message_t*)&osp_out_ephemeris_data, (osp_message_t*)&osp_out_oktosend, (osp_message_t*)&osp_out_geodetic_navigation_data, + (osp_message_t*)&osp_out_1pps_time, (osp_message_t*)&osp_out_gpio_state, (osp_message_t*)&osp_out_hw_config_req, (osp_message_t*)&osp_out_aiding_request,