main_ubi_sdk v 0.1.3
This is UBI4 documentation
uart_port.h
Go to the documentation of this file.
1/*
2 ******************************************************************************
3 * @file uart_port.h
4 * @author A.Alborov
5 ******************************************************************************
6*/
7
8#ifndef INC_UART_PORT_H_
9#define INC_UART_PORT_H_
10
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16
17#include "UBI_SDK.h"
19
20#ifdef UBI_SDK_FAMILY_STM32
21#ifdef UART_PORT_EN
22
23#include "HAL_DRIVERS.h"
24#include "stdbool.h"
25
26 typedef struct
27 {
28 uint8_t* queue_array;
29 uint16_t read_counter;
30 uint16_t write_counter;
31 uint16_t size;
32 }buffer_queue_struct;
33
34
35
36 typedef struct
37 {
38 uint8_t* rx_buffer;
39 uint16_t rx_buffer_size;
40
41 uint8_t* tx_buffer;
42 uint16_t tx_buffer_size;
43
44 UART_HandleTypeDef* uart_config;
45
46 }uart_init_port_struct;
47
48 typedef struct
49 {
51
52 uart_init_port_struct* init_struct;
53
54 uint8_t wait_receive_enable;
55
56 }uart_port_struct;
57
58
59
60
61 extern buffer_queue_struct tx_queue;
62 extern buffer_queue_struct rx_queue;
63
64
65 void uart_port_init(uart_init_port_struct* init_struct, uart_port_struct** out_port_struct);
66 void uart_port_wait_receive(uart_port_struct* port_str, uint32_t offset, uint32_t len);
67
68void uart_port_init0(UART_HandleTypeDef* huart);
69
70void uart_port_transmit(uint8_t* Buf, uint16_t Size);
71
72//void uart_port_wait_receive(uint8_t* Buf, uint16_t Size);
73
74void uart_port_receive(UART_HandleTypeDef* huart);
75
76void uart_port_start(void* p);
77
78void uart_port_wait_fixed_receive();
79void uart_port_wait_float_receive(uint16_t size);
80
81bool uart_port_receive_float_len();
82
83
84uint8_t* ReadQueue(buffer_queue_struct* buffer_queue, uint16_t size);
85
86uint16_t QueueSize(buffer_queue_struct* buffer_queue);
87
88uint8_t* GetQueueBufferPointer(buffer_queue_struct* buffer_queue, uint16_t* size);
89bool FinishWriteToBuffer(buffer_queue_struct* buffer_queue, uint16_t Size);
90
91#endif
92#endif
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* INC_UART_PORT_H_ */
Definition a_port.h:99