48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/*
|
|
* @Author: Memory 1619005172@qq.com
|
|
* @Date: 2026-04-15 18:00:45
|
|
* @LastEditors: Memory 1619005172@qq.com
|
|
* @LastEditTime: 2026-04-15 19:25:36
|
|
* @FilePath: \MDK-ARMd:\Project\MFT\Motor\User\bsp\inc\bsp_usart_dma.h
|
|
* @Description:
|
|
*/
|
|
#ifndef __USARTDMA_H
|
|
#define __USARTDMA_H
|
|
|
|
#include "stm32f10x.h"
|
|
#include <stdio.h>
|
|
|
|
// 串口工作参数宏定义
|
|
#define DEBUG_USARTx USART1
|
|
#define DEBUG_USART_CLK RCC_APB2Periph_USART1
|
|
#define DEBUG_USART_APBxClkCmd RCC_APB2PeriphClockCmd
|
|
#define DEBUG_USART_BAUDRATE 115200
|
|
|
|
// USART GPIO 引脚宏定义
|
|
#define DEBUG_USART_GPIO_CLK (RCC_APB2Periph_GPIOA)
|
|
#define DEBUG_USART_GPIO_APBxClkCmd RCC_APB2PeriphClockCmd
|
|
|
|
#define DEBUG_USART_TX_GPIO_PORT GPIOA
|
|
#define DEBUG_USART_TX_GPIO_PIN GPIO_Pin_9
|
|
#define DEBUG_USART_RX_GPIO_PORT GPIOA
|
|
#define DEBUG_USART_RX_GPIO_PIN GPIO_Pin_10
|
|
|
|
#define DEBUG_USART_IRQ USART1_IRQn
|
|
#define DEBUG_USART_IRQHandler USART1_IRQHandler
|
|
|
|
// 串口对应的DMA请求通道
|
|
#define USART_RX_DMA_CHANNEL DMA1_Channel5
|
|
// 外设寄存器地址
|
|
#define USART_DR_ADDRESS (USART1_BASE + 0x04)
|
|
// 一次发送的数据量
|
|
#define RECEIVEBUFF_SIZE 64
|
|
|
|
void USART_Config(void);
|
|
void USARTx_DMA_Config(void);
|
|
void Usart_SendArray(USART_TypeDef *pUSARTx, uint8_t *array, uint16_t num);
|
|
|
|
extern uint8_t g_ucRxRcvNewFlag;
|
|
extern uint8_t g_RxBuf[64];
|
|
|
|
#endif /* __USARTDMA_H */
|