您现在的位置: 主页 > 嵌入式开发入门到精通 > 单片机技术进阶 > STM32F4(USART+DMA+静态内存) -
本文所属标签:
为本文创立个标签吧:

STM32F4(USART+DMA+静态内存) -

来源: 网络用户发布,如有版权联系网管删除 2018-09-08 

[导读]
1,开发环境 1,适用芯片:STM32F4全部芯片 2,固件库:STM32F4xx_DSP_StdPeriph_Lib_V1.8.0 3,IDE:MDK5172,驱动源码 USART.h文件/*************************************************************

1,开发环境

本文引用地址: http://www.21ic.com/app/mcu/201806/764646.htm

1,适用芯片:STM32F4全部芯片

2,固件库:STM32F4xx_DSP_StdPeriph_Lib_V1.8.0

3,IDE:MDK517


2,驱动源码

USART.h文件

/****************************************************************

* Copyright (C) 2016, XinLi, all right reserved.

* File name: USART.h

* Date: 2016.03.22

* Description: USART Driver

*****************************************************************/

#ifndef __USART_H

#define __USART_H

/****************************************************************

* Header include

*****************************************************************/

#include "stm32f4xx.h"

/****************************************************************

* Macro definition

*****************************************************************/

#define USART1_BufferSize_Tx (0)

#define USART1_BufferSize_Rx (0)

#define USART2_BufferSize_Tx (0)

#define USART2_BufferSize_Rx (0)

#if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx) || defined(STM32F446xx) || defined(STM32F412xG) || defined(STM32F413_423xx)

#define USART3_BufferSize_Tx (0)

#define USART3_BufferSize_Rx (0)

#endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F469_479xx || STM32F446xx || STM32F412xG || STM32F413_423xx */

#if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx) || defined(STM32F446xx) || defined(STM32F413_423xx)

#define USART4_BufferSize_Tx (0)

#define USART4_BufferSize_Rx (0)

#define USART5_BufferSize_Tx (0)

#define USART5_BufferSize_Rx (0)

#endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F469_479xx || STM32F446xx || STM32F413_423xx */

#define USART6_BufferSize_Tx (0)

#define USART6_BufferSize_Rx (0)

#if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx) || defined(STM32F413_423xx)

#define USART7_BufferSize_Tx (0)

#define USART7_BufferSize_Rx (0)

#define USART8_BufferSize_Tx (0)

#define USART8_BufferSize_Rx (0)

#endif /* STM32F427_437xx || STM32F429_439xx || STM32F469_479xx || STM32F413_423xx */

#if defined(STM32F413_423xx)

#define USART9_BufferSize_Tx (0)

#define USART9_BufferSize_Rx (0)

#define USART10_BufferSize_Tx (0)

#define USART10_BufferSize_Rx (0)

#endif /* STM32F413_423xx */

/********************* USART1 Configuration *********************/

#define RCC_AHB1Periph_USART1_Tx RCC_AHB1Periph_GPIOA

#define RCC_AHB1Periph_USART1_Rx RCC_AHB1Periph_GPIOA

#define GPIO_USART1_Tx GPIOA

#define GPIO_USART1_Rx GPIOA

#define GPIO_Pin_USART1_Tx GPIO_Pin_9

#define GPIO_Pin_USART1_Rx GPIO_Pin_10

#define GPIO_PinSource_USART1_Tx GPIO_PinSource9

#define GPIO_PinSource_USART1_Rx GPIO_PinSource10

/****************************************************************/

/********************* USART2 Configuration *********************/

#define RCC_AHB1Periph_USART2_Tx RCC_AHB1Periph_GPIOA

#define RCC_AHB1Periph_USART2_Rx RCC_AHB1Periph_GPIOA

#define GPIO_USART2_Tx GPIOA

#define GPIO_USART2_Rx GPIOA

#define GPIO_Pin_USART2_Tx GPIO_Pin_2

#define GPIO_Pin_USART2_Rx GPIO_Pin_3

#define GPIO_PinSource_USART2_Tx GPIO_PinSource2

#define GPIO_PinSource_USART2_Rx GPIO_PinSource3

/****************************************************************/

#if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx) || defined(STM32F446xx) || defined(STM32F412xG) || defined(STM32F413_423xx)

/********************* USART3 Configuration *********************/

#define RCC_AHB1Periph_USART3_Tx RCC_AHB1Periph_GPIOB

#define RCC_AHB1Periph_USART3_Rx RCC_AHB1Periph_GPIOB

#define GPIO_USART3_Tx GPIOB

#define GPIO_USART3_Rx GPIOB

#define GPIO_Pin_USART3_Tx GPIO_Pin_10

#define GPIO_Pin_USART3_Rx GPIO_Pin_11

#define GPIO_PinSource_USART3_Tx GPIO_PinSource10

#define GPIO_PinSource_USART3_Rx GPIO_PinSource11

/****************************************************************/

#endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F469_479xx || STM32F446xx || STM32F412xG || STM32F413_423xx */

#if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx) || defined(STM32F446xx) || defined(STM32F413_423xx)

/********************* USART4 Configuration *********************/

#define RCC_AHB1Periph_USART4_Tx RCC_AHB1Periph_GPIOC

#define RCC_AHB1Periph_USART4_Rx RCC_AHB1Periph_GPIOC

#define GPIO_USART4_Tx GPIOC

#define GPIO_USART4_Rx GPIOC

#define GPIO_Pin_USART4_Tx GPIO_Pin_10

#define GPIO_Pin_USART4_Rx GPIO_Pin_11

#define GPIO_PinSource_USART4_Tx GPIO_PinSource10

#define GPIO_PinSource_USART4_Rx GPIO_PinSource11

/****************************************************************/

/********************* USART5 Configuration *********************/

#define RCC_AHB1Periph_USART5_Tx RCC_AHB1Periph_GPIOC

#define RCC_AHB1Periph_USART5_Rx RCC_AHB1Periph_GPIOD

#define GPIO_USART5_Tx GPIOC

#define GPIO_USART5_Rx GPIOD

#define GPIO_Pin_USART5_Tx GPIO_Pin_12

#define GPIO_Pin_USART5_Rx GPIO_Pin_2

#define GPIO_PinSource_USART5_Tx GPIO_PinSource12

#define GPIO_PinSource_USART5_Rx GPIO_PinSource2

/****************************************************************/

#endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F469_479xx || STM32F446xx || STM32F413_423xx */

/********************* USART6 Configuration *********************/

#define RCC_AHB1Periph_USART6_Tx RCC_AHB1Periph_GPIOC

#define RCC_AHB1Periph_USART6_Rx RCC_AHB1Periph_GPIOC

#define GPIO_USART6_Tx GPIOC

#define GPIO_USART6_Rx GPIOC

#define GPIO_Pin_USART6_Tx GPIO_Pin_6

#define GPIO_Pin_USART6_Rx GPIO_Pin_7

#define GPIO_PinSource_USART6_Tx GPIO_PinSource6

#define GPIO_PinSource_USART6_Rx GPIO_PinSource7

/****************************************************************/

#if defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F469_479xx) || defined(STM32F413_423xx)

/********************* USART7 Configuration *********************/

#define RCC_AHB1Periph_USART7_Tx RCC_AHB1Periph_GPIOE

#define RCC_AHB1Periph_USART7_Rx RCC_AHB1Periph_GPIOE

#define GPIO_USART7_Tx GPIOE

#define GPIO_USART7_Rx GPIOE

#define GPIO_Pin_USART7_Tx GPIO_Pin_8

#define GPIO_Pin_USART7_Rx GPIO_Pin_7

#define GPIO_PinSource_USART7_Tx GPIO_PinSource8

#define GPIO_PinSource_USART7_Rx GPIO_PinSource7

/****************************************************************/

/********************* USART8 Configuration *********************/

#define RCC_AHB1Periph_USART8_Tx RCC_AHB1Periph_GPIOE

#define RCC



              查看评论 回复



 

"STM32F4(USART+DMA+静态内存) -"的相关文章

网站地图

围观()