Hierodule 1.6.2
Utility module set for STM32 MCUs
Loading...
Searching...
No Matches
hierodule_usart.h
Go to the documentation of this file.
1
12#ifndef __HIERODULE_USART_H
13#define __HIERODULE_USART_H
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
35#include <main.h>
36#include <stddef.h>
37#include <stdlib.h>
38
42typedef struct
43{
47 USART_TypeDef *USART;
48
52 uint32_t RX_Index;
53
57 uint32_t RX_New;
58
62 uint8_t *RX_Buffer;
63
67 uint16_t RX_BufferSize;
68
74 void (*RX_Handler)(uint8_t);
76
83(
84 USART_TypeDef *USART,
85 uint16_t RX_BufferSize,
86 void (*RX_Handler)(uint8_t)
87);
88
95
102
109
115
121
127
134
141
149#ifdef __cplusplus
150}
151#endif
152
153#endif /* __HIERODULE_USART_H */
154
155
uint32_t HIERODULE_USART_IsActiveFlag_TXE(HIERODULE_USART_Wrapper *Wrapper)
Checks the TX is empty interrupt flag of the USART peripheral.
uint32_t HIERODULE_USART_IsActiveFlag_RXNE(HIERODULE_USART_Wrapper *Wrapper)
Checks the RX not empty interrupt flag of the USART peripheral.
void HIERODULE_USART_TransmitByte(HIERODULE_USART_Wrapper *Wrapper, uint8_t Byte)
Transmits a single byte.
void HIERODULE_USART_ReleaseWrapper(HIERODULE_USART_Wrapper *Wrapper)
Frees the memory allocated to a USART wrapper and clears USART status flags and control bits.
uint8_t HIERODULE_USART_GetNextByte(HIERODULE_USART_Wrapper *Wrapper)
Fetches the next byte in the ring buffer.
void HIERODULE_USART_TransmitString(HIERODULE_USART_Wrapper *Wrapper, char *String)
Transmits a string.
void HIERODULE_USART_Disable_IT_RXNE(HIERODULE_USART_Wrapper *Wrapper)
Disables the RX not empty interrupt of the USART peripheral , also disables the RE bit of the control...
void HIERODULE_USART_Enable_IT_RXNE(HIERODULE_USART_Wrapper *Wrapper)
Enables the RX not empty interrupt of the USART peripheral , also enables the RE bit of the control r...
HIERODULE_USART_Wrapper ** HIERODULE_USART_InitWrapper(USART_TypeDef *USART, uint16_t RX_BufferSize, void(*RX_Handler)(uint8_t))
Initializes a wrapper for the specified USART peripheral.
HIERODULE_USB_Wrapper Wrapper
Extern declaration for the wrapper instance in the source file.
Struct that keeps variables for the ring buffer, a pointer to the USART peripheral and a pointer to t...
uint8_t * RX_Buffer
The ring buffer.
uint32_t RX_New
Number of new bytes in the ring buffer.
uint16_t RX_BufferSize
Number of elements in the ring buffer.
USART_TypeDef * USART
Pointer to the USART peripheral.
uint32_t RX_Index
Index of next-byte-to-be-received in the ring buffer.