monoZ docs
MZ_uart3_instance.c
Go to the documentation of this file.
1
7#include "MZ_uart3_instance.h"
8#include "MZ_public.h"
9#include "MZ_uart.h"
10
11static char rx_char = 0;
12
13static void uart3_tx_intr(void * arg)
14{
15 st_uart_intr evt = * (st_uart_intr *)arg;
16 (void)evt;
17
18 // Transmission complete
19}
20
21static void uart3_rx_intr(void * arg)
22{
23 st_uart_intr evt = * (st_uart_intr *)arg;
24 (void)evt;
25
26 // 1 Byte Receive complete - Initiate another Byte receive
27 (void)MZ_UART_Receive_IT(MZ_UART_INSTANCE, (uint8_t *)&rx_char, 1);
28}
29
31{
33 .Init.BaudRate = MZ_UART3_INIT_BAUDRATE,
34 .Init.WordLength = MZ_UART3_INIT_WORDLENGTH,
35 .Init.StopBits = MZ_UART3_INIT_STOPBITS,
36 .Init.Parity = MZ_UART3_INIT_PARITY,
37 .Init.Mode = MZ_UART3_INIT_MODE,
38 .Init.HwFlowCtl = MZ_UART3_INIT_HWFLOWCTL,
39 .Init.OverSampling = MZ_UART3_INIT_OVERSAMPLING,
40 .Init.OneBitSampling = MZ_UART3_INIT_ONEBITSAMPLING,
41 .AdvancedInit.AdvFeatureInit = MZ_UART3_ADVANCEDINIT_ADVFEATUREINIT
42};
43
44
46{
47 mz_error_t _ret = MZ_FAIL;
48
50 {
52 {
53 _ret = MZ_OK;
54 // Initiate 1 Byte receive
55 (void)MZ_UART_Receive_IT(MZ_UART_INSTANCE, (uint8_t *)&rx_char, 1);
56 }
57 }
58 return _ret;
59}
60
61
mz_error_t
Enumeration of monoZ Error Flags.
@ MZ_OK
@ MZ_FAIL
monoZ Public All peripheral Configurations will send to monoZ library through this file
MZ_UART_INIT_ST uart3_instance
mz_error_t UART3_init(void)
UART initialize.
static char rx_char
static void uart3_rx_intr(void *arg)
static void uart3_tx_intr(void *arg)
Create UART instance.
#define MZ_UART_INSTANCE
Define UART Instance.
#define MZ_UART3_INIT_STOPBITS
Define the Monoz Uart3 Initial STOPBITS.
#define MZ_UART3_INIT_PARITY
Define the Monoz Uart3 Initial PARITY.
#define MZ_UART3_INIT_MODE
Define the Monoz Uart3 Initial MODE.
#define MZ_UART3_INIT_HWFLOWCTL
Define the Monoz Uart3 Initial HARWARE FLOW CONTROL( HWFLOWCTL)
#define MZ_UART3_INIT_BAUDRATE
Define the Monoz Uart3 Initial BAUDRATE.
#define MZ_UART3_INSTANCE
Define the Monoz Uart3 INSTANCE.
#define MZ_UART3_INIT_OVERSAMPLING
Define the Monoz Uart3 Initial Over sampling rate.
#define MZ_UART3_INIT_ONEBITSAMPLING
Define the Monoz Uart3 Initial ONE BIT SAMPLING to be Disabled.
#define MZ_UART3_INIT_WORDLENGTH
Define the Monoz Uart3 Initial WORDLENGTH.
#define MZ_UART3_ADVANCEDINIT_ADVFEATUREINIT
Define Advance feature.
This file includes monoZ Uart Related APIs.
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_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
USART_TypeDef * Instance
Definition: MZ_public.h:22
Structure for UART state Handler.
Definition: MZ_uart.h:81