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_FAMALY_NRF52
21#include "HAL_DRIVERS.h"
22#include "stdbool.h"
23
24 typedef struct
25 {
26 uint8_t* queue_array;
27 uint16_t read_counter;
28 uint16_t write_counter;
29 uint16_t size;
30 }buffer_queue_struct;
31
32
33 typedef struct
34 {
35 uint8_t* rx_buffer;
36 uint16_t rx_buffer_size;
37
38 uint8_t* tx_buffer;
39 uint16_t tx_buffer_size;
40
41 void (*uart_port_rx_callback)(base_port_struct* port);
42
43 void (*uart_port_tx_callback)(base_port_struct* port);
44
45 app_uart_comm_params_t uart_config;
46
47 app_irq_priority_t irq_priority;
48
49 }uart_init_port_struct;
50
51 typedef struct
52 {
54
55 uart_init_port_struct* init_struct;
56
57 uint8_t* last_data_rx_p;
58 uint32_t last_data_rx_size;
59
60 }uart_port_struct;
61
62
63/*
64
65 extern buffer_queue_struct tx_queue;
66 extern buffer_queue_struct rx_queue;
67*/
68void abort_uart();
69bool check_buff_dma(uart_port_struct* port_str);
70
71 void uart_port_init(uart_init_port_struct* init_struct, uart_port_struct** out_port_struct);
72 void uart_port_wait_receive(uart_port_struct* port_str, uint32_t offset, uint32_t len);
73
74void uart_port_init0(void* huart);
75
76void uart_port_transmit(uint8_t* Buf, uint16_t Size);
77
78//void uart_port_wait_receive(uint8_t* Buf, uint16_t Size);
79
80void uart_port_receive(void* huart);
81
82void uart_port_start(void* p);
83
84void uart_port_wait_fixed_receive();
85void uart_port_wait_float_receive(uint16_t size);
86
87bool uart_port_receive_float_len();
88
89
90uint8_t* ReadQueue(buffer_queue_struct* buffer_queue, uint16_t size);
91
92uint16_t QueueSize(buffer_queue_struct* buffer_queue);
93
94uint8_t* GetQueueBufferPointer(buffer_queue_struct* buffer_queue, uint16_t* size);
95bool FinishWriteToBuffer(buffer_queue_struct* buffer_queue, uint16_t Size);
96
97#endif
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif /* INC_UART_PORT_H_ */
Definition a_port.h:99