firmware
IEM Firmware Documentation
Loading...
Searching...
No Matches
vnav.c File Reference

VectorNav IMU/GNSS task. More...

#include "vnav.h"
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>
#include "rtos.h"
#include "iem_utils.h"
#include "constants.h"
#include "types.h"
#include "main.h"
#include "can_rtos.h"
#include "can_1.h"
#include "can_2.h"
Include dependency graph for vnav.c:

Data Structures

struct  vnav_t
struct  vnav_t::__packed
union  vnav_uart_notif
struct  vnav_status_info

Macros

#define VNAV_UART_BAUD_RATE   921600
#define VNAV_OUTPUT_FREQ_HZ   400
#define UART_RX_TIMEOUT_TICKS   pdMS_TO_TICKS(3)
#define VNAV_PERIOD_APPROX_TICKS   pdMS_TO_TICKS(4)
#define VNAV_START_DELIMITER   0xFA
#define VNAV_SYNC_OUT_EXTI_LINE   EXTI_LINE_10
#define NS_TO_MS   1000000

Functions

static void task_vnav (void *task_params_ptr)
 Implements the VectorNav task.
static void vnav_logging (enum vnav_state state, struct vnav_status_info *status_info, union vnav_uart_notif notif)
 Packs and sends VectorNav logging messages on CAN 2.
static void tv_inputs_logging (enum vnav_state state)
 Packs and sends VectorNav logging messages on CAN ''2.
static void uart_rx_event_callback (UART_HandleTypeDef *huart, uint16_t pos)
static void uart_tx_cplt_callback (UART_HandleTypeDef *huart)
static void uart_error_callback (UART_HandleTypeDef *huart)
static uint16_t vnav_crc16 (uint8_t *start, size_t len)
void task_vnav_init (Global_Handles_t *hdls_ptr)
 Initialize the VectorNav task and hardware peripherals.
void vnav_sync_out_exti_callback (void)

Variables

enum __packed vnav_gnss_fix
 VNAV_GNSS_NO_FIX = 0U
 VNAV_GNSS_TIME_ONLY_FIX
 VNAV_GNSS_2D_FIX
 VNAV_GNSS_3D_FIX
 VNAV_GNSS_SBAS_FIX
 VNAV_GNSS_APPROX_RTK_FIX
 VNAV_GNSS_RTK_FIX
enum __packed vnav_ins_mode
 VNAV_INS_NOT_TRACKING = 0U
 VNAV_INS_ALIGNING
 VNAV_INS_TRACKING
 VNAV_INS_GNSS_LOST
static DMA_VAR struct vnav_t g_vnav_rx_buffer

Detailed Description

VectorNav IMU/GNSS task.

Author
Jamie Pruett :)
Version
0.1
Date
2025-05-19

Macro Definition Documentation

◆ NS_TO_MS

#define NS_TO_MS   1000000

◆ UART_RX_TIMEOUT_TICKS

#define UART_RX_TIMEOUT_TICKS   pdMS_TO_TICKS(3)

◆ VNAV_OUTPUT_FREQ_HZ

#define VNAV_OUTPUT_FREQ_HZ   400

◆ VNAV_PERIOD_APPROX_TICKS

#define VNAV_PERIOD_APPROX_TICKS   pdMS_TO_TICKS(4)

◆ VNAV_START_DELIMITER

#define VNAV_START_DELIMITER   0xFA

◆ VNAV_SYNC_OUT_EXTI_LINE

#define VNAV_SYNC_OUT_EXTI_LINE   EXTI_LINE_10

◆ VNAV_UART_BAUD_RATE

#define VNAV_UART_BAUD_RATE   921600

Function Documentation

◆ task_vnav()

void task_vnav ( void * task_params_ptr)
static

Implements the VectorNav task.

Parameters
task_params_ptrPointer to the FreeRTOS handles struct
Here is the call graph for this function:
Here is the caller graph for this function:

◆ task_vnav_init()

void task_vnav_init ( Global_Handles_t * hdls_ptr)

Initialize the VectorNav task and hardware peripherals.

Parameters
hdls_ptrPointer to FreeRTOS handles struct
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tv_inputs_logging()

void tv_inputs_logging ( enum vnav_state state)
static

Packs and sends VectorNav logging messages on CAN ''2.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart_error_callback()

void uart_error_callback ( UART_HandleTypeDef * huart)
static
Here is the caller graph for this function:

◆ uart_rx_event_callback()

void uart_rx_event_callback ( UART_HandleTypeDef * huart,
uint16_t pos )
static
Here is the caller graph for this function:

◆ uart_tx_cplt_callback()

void uart_tx_cplt_callback ( UART_HandleTypeDef * huart)
static
Here is the caller graph for this function:

◆ vnav_crc16()

uint16_t vnav_crc16 ( uint8_t * start,
size_t len )
static
Here is the caller graph for this function:

◆ vnav_logging()

void vnav_logging ( enum vnav_state state,
struct vnav_status_info * status_info,
union vnav_uart_notif notif )
static

Packs and sends VectorNav logging messages on CAN 2.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vnav_sync_out_exti_callback()

void vnav_sync_out_exti_callback ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_vnav_rx_buffer

DMA_VAR struct vnav_t g_vnav_rx_buffer
static

◆ VNAV_GNSS_2D_FIX

VNAV_GNSS_2D_FIX

◆ VNAV_GNSS_3D_FIX

VNAV_GNSS_3D_FIX

◆ VNAV_GNSS_APPROX_RTK_FIX

VNAV_GNSS_APPROX_RTK_FIX

◆ vnav_gnss_fix

enum __packed vnav_gnss_fix

◆ VNAV_GNSS_NO_FIX

VNAV_GNSS_NO_FIX = 0U

◆ VNAV_GNSS_RTK_FIX

VNAV_GNSS_RTK_FIX

◆ VNAV_GNSS_SBAS_FIX

VNAV_GNSS_SBAS_FIX

◆ VNAV_GNSS_TIME_ONLY_FIX

VNAV_GNSS_TIME_ONLY_FIX

◆ VNAV_INS_ALIGNING

VNAV_INS_ALIGNING

◆ VNAV_INS_GNSS_LOST

VNAV_INS_GNSS_LOST

◆ vnav_ins_mode

enum __packed vnav_ins_mode

◆ VNAV_INS_NOT_TRACKING

VNAV_INS_NOT_TRACKING = 0U

◆ VNAV_INS_TRACKING

VNAV_INS_TRACKING