芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

飞芯科技-芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

IC解密STM32L151 DMA+UART空闲中断收发数据

IC解密#ifndef __BSP_UART_H
IC解密#define __BSP_UART_H



#define USART1_TX_LEN 1024
#define USART1_RX_LEN 1024

#define USART2_TX_LEN 1024
#define USART2_RX_LEN 1024

#define USART3_TX_LEN 1024
#define USART3_RX_LEN 1024

void Uart1_Init(void);
void Uart1_DMA_TxConfig(uint8_t TransSize);
void Uart1_DMA_RxConfig(void);

void Uart2_Init(void);
void Uart2_DMA_TxConfig(uint8_t TransSize);
void Uart2_DMA_RxConfig(void);

void Uart3_Init(void);
void Uart3_DMA_TxConfig(uint8_t TransSize);
void Uart3_DMA_RxConfig(void);

#endif
//接收缓存区
uint8_t Uart1_Rx_Flag;//接收到数据请求标志
uint8_t Uart1_Rx_Buf[USART1_RX_LEN];//接收缓冲,最USART1_RX_LEN个字节
//发送缓存区
uint8_t Uart1_Tx_Buf[USART1_TX_LEN];//发送缓冲,最USART1_TX_LEN个字节

uint16_t Uart1_ReceiveSize;

//接收缓存区
uint8_t Uart2_Rx_Flag;//接收到数据请求标志
uint8_t Uart2_Rx_Buf[USART2_RX_LEN];//接收缓冲,最USART1_RX_LEN个字节
//发送缓存区
uint8_t Uart2_Tx_Buf[USART2_TX_LEN];//发送缓冲,最USART1_TX_LEN个字节

uint16_t Uart2_ReceiveSize;

//接收缓存区
uint8_t Uart3_Rx_Flag;//接收到数据请求标志
uint8_t Uart3_Rx_Buf[USART3_RX_LEN];//接收缓冲,最USART1_RX_LEN个字节
//发送缓存区
uint8_t Uart3_Tx_Buf[USART3_TX_LEN];//发送缓冲,最USART1_TX_LEN个字节

uint16_t Uart3_ReceiveSize;
/**
  * @brief  Configures the UART1.
  * @param  None
  * @retval None
  */
static void UART1_Configuration(void)
{
        GPIO_InitTypeDef  GPIO_InitStructure;
        USART_InitTypeDef USART_InitStructure;
       
        RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);//使能GPIOA时钟
       
        //打开 UART 时钟
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
        //Enable DMA1 clock
        RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1,ENABLE);
       
        GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1);
        GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1);
        //USART1_TX   PA9
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
       
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;        //复用推挽输出
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_Init(GPIOA, &GPIO_InitStructure); //初始化PA9



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.feixindz.com
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信