STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
board_uart9.h
Go to the documentation of this file.
1#ifndef STAR_BOARD_UART9_H
2#define STAR_BOARD_UART9_H
3
4/*
5 * UART9 to the MAX-M10S (PD14 RX <- GPS TXD, PD15 TX -> GPS RXD; schematic
6 * p.10). Interrupt-driven receive (HAL ReceiveToIdle, hardware FIFO at half
7 * full, see the .ioc) into a ring buffer; each burst sets the owning task's
8 * thread flag. No DMA, so no DTCM/RAM_D1 concern. Transmit is blocking and
9 * short (UBX config frames).
10 */
11
12#include <stdbool.h>
13#include <stddef.h>
14#include <stdint.h>
15
16#include "cmsis_os2.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/* Start receiving; each received burst sets `flag` on `thread`. */
23bool board_uart9_start(osThreadId_t thread, uint32_t flag);
24
25/* Received bytes, oldest first; returns how many were copied. */
26size_t board_uart9_read(uint8_t* out, size_t cap);
27
28/* Blocking transmit, bounded at 100 ms. */
29void board_uart9_send(const uint8_t* bytes, uint16_t len);
30
31/* Re-open at another baud (receive restarts; the ring is kept). */
32void board_uart9_set_baud(uint32_t baud);
33
34/* Only reconfigure the UART at `baud`, FIFO included, without starting the
35 * interrupt receive (the self-test's polled listen). Every baud change goes
36 * through this: a bare HAL_UART_Init turns the hardware FIFO off. */
37bool board_uart9_apply_baud(uint32_t baud);
38
39/* Bytes received since boot (counts on past a full ring); bytes dropped
40 * because the ring was full; UART errors seen. */
41uint32_t board_uart9_rx_bytes(void);
42uint32_t board_uart9_overflows(void);
43uint32_t board_uart9_errors(void);
44
45#ifdef __cplusplus
46}
47#endif
48#endif
size_t board_uart9_read(uint8_t *out, size_t cap)
Definition board_uart9.c:45
uint32_t board_uart9_overflows(void)
Definition board_uart9.c:70
bool board_uart9_start(osThreadId_t thread, uint32_t flag)
Definition board_uart9.c:38
uint32_t board_uart9_rx_bytes(void)
Definition board_uart9.c:67
bool board_uart9_apply_baud(uint32_t baud)
Definition board_uart9.c:23
uint32_t board_uart9_errors(void)
Definition board_uart9.c:73
void board_uart9_set_baud(uint32_t baud)
Definition board_uart9.c:59
void board_uart9_send(const uint8_t *bytes, uint16_t len)
Definition board_uart9.c:55
void * osThreadId_t
Definition cmsis_os2.h:211
static osThreadId_t thread
Definition gnss_task.c:13