ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
tlm_uart.c File Reference

Frame transmission via UART + DMA, synchronised with a CMSIS-RTOS2 semaphore. More...

#include "tlm_uart.h"
#include "cmsis_os2.h"
#include <string.h>
Include dependency graph for tlm_uart.c:

Go to the source code of this file.

Macros

#define TLM_UART_BUF   256u
 

Functions

int tlm_uart_init (UART_HandleTypeDef *huart)
 
int tlm_uart_send (const uint8_t *buf, uint16_t len, uint32_t timeout_ms)
 Non-blocking beyond timeout_ms: if the previous DMA has not finished, the frame is dropped.
 
void tlm_uart_tx_cplt_isr (UART_HandleTypeDef *huart)
 To be called from HAL_UART_TxCpltCallback() (see 03 - Docs/firmware/build.md)
 
uint32_t tlm_uart_dropped (void)
 

Variables

static UART_HandleTypeDef * s_huart
 
static osSemaphoreId_t s_txFree
 
static uint8_t s_dmaBuf [TLM_UART_BUF]
 
static volatile uint32_t s_dropped
 

Detailed Description

Frame transmission via UART + DMA, synchronised with a CMSIS-RTOS2 semaphore.

Definition in file tlm_uart.c.

Macro Definition Documentation

◆ TLM_UART_BUF

#define TLM_UART_BUF   256u

Definition at line 9 of file tlm_uart.c.

Function Documentation

◆ tlm_uart_init()

int tlm_uart_init ( UART_HandleTypeDef *  huart)

Definition at line 16 of file tlm_uart.c.

References s_huart, and s_txFree.

Referenced by TelemetryTask().

Here is the caller graph for this function:

◆ tlm_uart_send()

int tlm_uart_send ( const uint8_t *  buf,
uint16_t  len,
uint32_t  timeout_ms 
)

Non-blocking beyond timeout_ms: if the previous DMA has not finished, the frame is dropped.

Definition at line 23 of file tlm_uart.c.

References s_dmaBuf, s_dropped, s_huart, s_txFree, and TLM_UART_BUF.

Referenced by tx_frame().

Here is the caller graph for this function:

◆ tlm_uart_tx_cplt_isr()

void tlm_uart_tx_cplt_isr ( UART_HandleTypeDef *  huart)

To be called from HAL_UART_TxCpltCallback() (see 03 - Docs/firmware/build.md)

Definition at line 36 of file tlm_uart.c.

References s_huart, and s_txFree.

Referenced by app_uart_tx_cplt().

Here is the caller graph for this function:

◆ tlm_uart_dropped()

uint32_t tlm_uart_dropped ( void  )

Definition at line 41 of file tlm_uart.c.

References s_dropped.

Referenced by send_status().

Here is the caller graph for this function:

Variable Documentation

◆ s_huart

UART_HandleTypeDef* s_huart
static

Definition at line 11 of file tlm_uart.c.

Referenced by tlm_uart_init(), tlm_uart_send(), and tlm_uart_tx_cplt_isr().

◆ s_txFree

osSemaphoreId_t s_txFree
static

Definition at line 12 of file tlm_uart.c.

Referenced by tlm_uart_init(), tlm_uart_send(), and tlm_uart_tx_cplt_isr().

◆ s_dmaBuf

uint8_t s_dmaBuf[TLM_UART_BUF]
static

Definition at line 13 of file tlm_uart.c.

Referenced by tlm_uart_send().

◆ s_dropped

volatile uint32_t s_dropped
static

Definition at line 14 of file tlm_uart.c.

Referenced by tlm_uart_dropped(), and tlm_uart_send().