51 lines
2.2 KiB
C
51 lines
2.2 KiB
C
/******************************************************************************
|
|
* File: MCU_UART_cfg.h
|
|
* Component: MCU_UART
|
|
* Description: Configuration for the MCU_UART driver. Defines instances,
|
|
* pin assignments, baud rates, data format, TX/RX async modes,
|
|
* and RX buffer sizing.
|
|
*
|
|
* Layer: MCU (hardware abstraction) - configuration
|
|
*****************************************************************************/
|
|
|
|
#ifndef MCU_UART_CFG_H
|
|
#define MCU_UART_CFG_H
|
|
|
|
#include "STD_TYPES.h"
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* INSTANCE ENUMERATION */
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
typedef enum
|
|
{
|
|
MCU_UART_INSTANCE_0 = 0U,
|
|
MCU_UART_NUM_INSTANCES
|
|
} MCU_UART_tenuInstance;
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* RX RING BUFFER SIZING */
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
/** @brief Number of address bits for the RX ring buffer (2^N bytes).
|
|
* Must be power of 2 for DMA ring wrap.
|
|
* 5 = 32, 6 = 64, 7 = 128, 8 = 256. */
|
|
#define MCU_UART_RX_BUFFER_SIZE_BITS 6U
|
|
#define MCU_UART_RX_BUFFER_SIZE (1U << MCU_UART_RX_BUFFER_SIZE_BITS)
|
|
#define MCU_UART_RX_BUFFER_MASK (MCU_UART_RX_BUFFER_SIZE - 1U)
|
|
|
|
/* ------------------------------------------------------------------------ */
|
|
/* INSTANCE 0 CONFIGURATION */
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
#define MCU_UART_0_TX_PIN 0U
|
|
#define MCU_UART_0_RX_PIN 1U
|
|
#define MCU_UART_0_BAUD_RATE 115200U
|
|
#define MCU_UART_0_DATA_BITS MCU_UART_DATA_BITS_8
|
|
#define MCU_UART_0_STOP_BITS MCU_UART_STOP_BITS_1
|
|
#define MCU_UART_0_PARITY MCU_UART_PARITY_NONE
|
|
#define MCU_UART_0_TX_ASYNC_MODE MCU_UART_ASYNC_DMA
|
|
#define MCU_UART_0_TX_COMPLETE_CALLBACK STD_NULL
|
|
#define MCU_UART_0_RX_ASYNC_MODE MCU_UART_ASYNC_ISR
|
|
|
|
#endif /* MCU_UART_CFG_H */ |