21 lines
858 B
C
21 lines
858 B
C
#include "main.h"
|
|
|
|
#define __USER_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
|
|
do{ \
|
|
(__HANDLE__)->__PPP_DMA_FIELD__ = (__DMA_HANDLE__); \
|
|
(__DMA_HANDLE__)->Parent = (__HANDLE__);} while(0U)
|
|
|
|
struct UARTSettings
|
|
{
|
|
USART_TypeDef *UARTx;
|
|
uint32_t UART_Speed;
|
|
GPIO_TypeDef *GPIOx;
|
|
uint16_t GPIO_PIN_RX;
|
|
uint16_t GPIO_PIN_TX;
|
|
DMA_Channel_TypeDef *DMAChannel; // DMAChannel = 0 if doesnt need
|
|
};
|
|
|
|
void User_UART_Init(UART_HandleTypeDef* huart, DMA_HandleTypeDef *DMAhuart, struct UARTSettings *uuart);
|
|
void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX);
|
|
void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Channel_TypeDef *DMAhuart);
|