9 #ifndef __ewf_interface_stm32_uart__h__included__
10 #define __ewf_interface_stm32_uart__h__included__
14 #if (USE_HAL_UART_REGISTER_CALLBACKS != 1)
15 #error UART register callbacks must be enabled for this interface
34 #ifndef EWF_INTERFACE_STM32_UART_CONFIG_UART_RX_QUEUE_SIZE
35 #define EWF_INTERFACE_STM32_UART_CONFIG_UART_RX_QUEUE_SIZE (256 * 8)
38 #ifndef EWF_INTERFACE_STM32_UART_CONFIG_RESPONSE_QUEUE_SIZE
39 #define EWF_INTERFACE_STM32_UART_CONFIG_RESPONSE_QUEUE_SIZE (8)
42 #ifndef EWF_INTERFACE_STM32_UART_CONFIG_URC_QUEUE_SIZE
43 #define EWF_INTERFACE_STM32_UART_CONFIG_URC_QUEUE_SIZE (8)
53 UART_HandleTypeDef* uart_handle_ptr;
55 uint8_t rx_buffer[
sizeof(uint8_t)];
79 #ifdef EWF_PARAMETER_CHECKING
80 #define EWF_INTERFACE_STM32_UART_INITIALIZE_HEADER(interface_ptr) \
82 (interface_ptr)->struct_magic = EWF_INTERFACE_STRUCT_MAGIC; \
83 (interface_ptr)->struct_size = EWF_INTERFACE_STRUCT_SIZE; \
84 (interface_ptr)->struct_version = EWF_INTERFACE_VERSION; \
85 (interface_ptr)->struct_type = EWF_INTERFACE_TYPE_STM32_UART; \
88 #define EWF_INTERFACE_STM32_UART_INITIALIZE_HEADER(interface_ptr)
96 #define EWF_INTERFACE_STM32_UART_STATIC_DECLARE(interface_ptr, interface_name_symb, uart_handle_ptr_param) \
98 static ewf_interface_stm32_uart ewf_interface_stm32_uart__implementation__##interface_name_symb = {0}; \
99 static ewf_interface ewf_interface_stm32_uart__interface__##interface_name_symb = {0}; \
100 ewf_interface_stm32_uart__implementation__##interface_name_symb.uart_handle_ptr = uart_handle_ptr_param; \
101 EWF_PLATFORM_QUEUE_STATIC_DECLARE( \
102 ewf_interface_stm32_uart__implementation__##interface_name_symb.rx_queue_ptr, \
103 ewf_interface_stm32_uart__uart_rx_queue__##interface_name_symb, \
105 EWF_INTERFACE_STM32_UART_CONFIG_UART_RX_QUEUE_SIZE); \
106 EWF_PLATFORM_QUEUE_STATIC_DECLARE( \
107 ewf_interface_stm32_uart__interface__##interface_name_symb.response_queue_ptr, \
108 ewf_interface_stm32_uart__response_queue__##interface_name_symb, \
109 ewf_interface_message, \
110 EWF_INTERFACE_STM32_UART_CONFIG_RESPONSE_QUEUE_SIZE); \
111 EWF_PLATFORM_QUEUE_STATIC_DECLARE( \
112 ewf_interface_stm32_uart__interface__##interface_name_symb.urc_queue_ptr, \
113 ewf_interface_stm32_uart__urc_queue__##interface_name_symb, \
114 ewf_interface_message, \
115 EWF_INTERFACE_STM32_UART_CONFIG_URC_QUEUE_SIZE); \
116 ewf_interface_stm32_uart__interface__##interface_name_symb.hardware_start = ewf_interface_stm32_uart_hardware_start; \
117 ewf_interface_stm32_uart__interface__##interface_name_symb.hardware_stop = ewf_interface_stm32_uart_hardware_stop; \
118 ewf_interface_stm32_uart__interface__##interface_name_symb.hardware_send = ewf_interface_stm32_uart_hardware_send; \
119 ewf_interface_stm32_uart__interface__##interface_name_symb.hardware_receive = ewf_interface_stm32_uart_hardware_receive; \
120 ewf_interface_stm32_uart__interface__##interface_name_symb.implementation_ptr = &(ewf_interface_stm32_uart__implementation__##interface_name_symb); \
121 interface_ptr = &(ewf_interface_stm32_uart__interface__##interface_name_symb); \
122 EWF_INTERFACE_STM32_UART_INITIALIZE_HEADER(interface_ptr); \
The Embedded Wireless Framework host interface API.
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
ewf_result ewf_interface_stm32_uart_hardware_start(ewf_interface *interface_ptr)
Start the STM32 UART hardware interface.
Definition: ewf_interface_stm32_uart.c:51
ewf_result ewf_interface_stm32_uart_hardware_receive(ewf_interface *interface_ptr, uint8_t *buffer_ptr, uint32_t *buffer_length_ptr, bool wait)
Receive a buffer using the STM32 UART hardware interface.
Definition: ewf_interface_stm32_uart.c:106
ewf_result ewf_interface_stm32_uart_hardware_stop(ewf_interface *interface_ptr)
Stop the STM32 UART hardware interface.
Definition: ewf_interface_stm32_uart.c:74
ewf_result ewf_interface_stm32_uart_hardware_send(ewf_interface *interface_ptr, const uint8_t *buffer_ptr, uint32_t buffer_length)
Send a buffer using the STM32 UART hardware interface.
Definition: ewf_interface_stm32_uart.c:90
struct _ewf_interface_stm32_uart ewf_interface_stm32_uart
The STM32 UART host interface implementation data structure type.
The STM32 UART host interface implementation data structure type.
Definition: ewf_interface_stm32_uart.h:52
The interface structure definition.
Definition: ewf_interface.h:66