monoZ docs
MZ_uart.h
Go to the documentation of this file.
1
8#ifndef MZ_UART_H_
9#define MZ_UART_H_
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14//#include "MZ_common.h"
15#include "MZ_public.h"
16#include "MZ_error_handler.h"
17
22typedef enum
23{
24#if(MZ_UART1 == 1)
26#endif
27#if(MZ_UART2 == 1)
29#endif
30#if(MZ_UART3 == 1)
32#endif
33#if(MZ_UART4 == 1)
34 _UART4,
35#endif
36#if(MZ_UART5 == 1)
37 _UART5,
38#endif
39#if(MZ_LPUART1 == 1)
41#endif
44
45#define UART_MAX_COUNT_SIZE UART_MAX_COUNT
46
57typedef struct
58{
60 UART_HandleTypeDef _handler;
72// _uart_api UART_process_api; /*!< UART Custom processing API */
75
80typedef struct
81{
82 UART_HandleTypeDef *uart_ptr;
83 enum
84 {
87 }event;
89
94typedef MZ_UARTX MZ_UART_BTYPE; /* UART Base Type */
95
100typedef MZ_UARTX * MZ_UART_BTYPE_PTR; /* UART Base Type pointer */
101
111
119
127
136
145
154
164mz_error_t MZ_UART_Transmit(uint8_t uart_no,uint8_t *pData,uint16_t Size,uint32_t Timeout);
165
175mz_error_t MZ_UART_Receive(uint8_t uart_no,uint8_t *pData,uint16_t Size,uint32_t Timeout);
176
185mz_error_t MZ_UART_Transmit_IT(uint8_t uart_no, uint8_t *pData, uint16_t Size);
186
195mz_error_t MZ_UART_Receive_IT(uint8_t uart_no, uint8_t *pData, uint16_t Size);
196
202void MZ_HAL_UART_IRQHandler(uint8_t uart_no);
204#ifdef __cplusplus
205}
206#endif
207#endif /* MZ_UART_H_ */
unsigned char mzUint8
1 Byte data type
Definition: MZ_common.h:57
unsigned long int mzUint32
4 Byte data type
Definition: MZ_common.h:95
mzReg
monoZ Register and Deregister
Definition: MZ_common.h:123
void(* _mz_fp)(void *)
Definition: MZ_common.h:33
monoZ Error Handler
mz_error_t
Enumeration of monoZ Error Flags.
monoZ Public All peripheral Configurations will send to monoZ library through this file
en_uart_no
Define UART on its state.
Definition: MZ_uart.h:23
@ UART_MAX_COUNT
Definition: MZ_uart.h:42
@ _USART1
Definition: MZ_uart.h:25
@ _USART3
Definition: MZ_uart.h:31
@ _USART2
Definition: MZ_uart.h:28
@ _LPUART1
Definition: MZ_uart.h:40
MZ_UARTX * MZ_UART_BTYPE_PTR
[TODO]
Definition: MZ_uart.h:100
MZ_UARTX MZ_UART_BTYPE
[TODO]
Definition: MZ_uart.h:94
_mz_fp _uart_api
[TODO]
Definition: MZ_uart.h:51
void MZ_HAL_UART_IRQHandler(uint8_t uart_no)
This function defines the Global Interrupt handler functions for UART.
mz_error_t MZ_UART_Transmit(uint8_t uart_no, uint8_t *pData, uint16_t Size, uint32_t Timeout)
This function is used to transmit data using UART in polling mode.
MZ_UART_BTYPE_PTR MZ_UART_reference(en_uart_no uart_no)
This function returns the address of the specific UART.
mz_error_t MZ_UART_register_intr_cb_tx(uint8_t uart_no, _uart_api cb)
This function registers the TX complete callback function for the specific UART.
mz_error_t MZ_UART_Transmit_IT(uint8_t uart_no, uint8_t *pData, uint16_t Size)
This function is used to transmit data using UART in interrupt mode.
MZ_UART_BTYPE_PTR MZ_UART_get_base_address(void)
This function returns the base address of the internal UART context.
mz_error_t MZ_UART_Receive(uint8_t uart_no, uint8_t *pData, uint16_t Size, uint32_t Timeout)
This function is used to receive data using UART in polling mode.
mz_error_t MZ_UART_init(MZ_UART_INIT_PTR _cfg)
This function initializes the specific UART.
mz_error_t MZ_UART_register_callback(uint8_t uart_no, _uart_api cb)
This function registers the event callback function for the specific UART.
mz_error_t MZ_UART_register_intr_cb_rx(uint8_t uart_no, _uart_api cb)
This function registers the RX complete callback function for the specific UART.
mz_error_t MZ_UART_Receive_IT(uint8_t uart_no, uint8_t *pData, uint16_t Size)
This function is used to receive data using UART in interrupt mode.
Structure for monoZ UART Initialization parameters.
Definition: MZ_public.h:21
Structure for UART Handling and API events.
Definition: MZ_uart.h:58
mzUint8 * _rx_buffer
Definition: MZ_uart.h:62
UART_HandleTypeDef _handler
Definition: MZ_uart.h:60
_uart_api UART_ev_call_back
Definition: MZ_uart.h:73
mzUint8 _enable
Definition: MZ_uart.h:61
_uart_api read
Definition: MZ_uart.h:68
mzUint8 _tx_intr
Definition: MZ_uart.h:67
mzUint8 * _tx_buffer
Definition: MZ_uart.h:64
_uart_api write
Definition: MZ_uart.h:69
mzUint8 _rx_intr
Definition: MZ_uart.h:66
_uart_api rx_intr_api
Definition: MZ_uart.h:70
mzReg _reg_status
Definition: MZ_uart.h:59
_uart_api tx_intr_api
Definition: MZ_uart.h:71
mzUint32 _tx_buffer_size
Definition: MZ_uart.h:65
mzUint32 _rx_buffer_size
Definition: MZ_uart.h:63
Structure for UART state Handler.
Definition: MZ_uart.h:81
UART_HandleTypeDef * uart_ptr
Definition: MZ_uart.h:82
@ FULL_COMPLETE
Definition: MZ_uart.h:85
@ HALF_COMPLETE
Definition: MZ_uart.h:86