为什么最新版的stm32f4xx.h文件中取消了u8, u16, u32的类型定义
刚对比了一下最新的STM32F4xx_DFP.2.9.0.pack包和Keil.STM32F4xx_DFP.1.0.8.pac包中的stm32f4xx.h文件, 发现本来在旧的.h文件中对uint_8等有类型定义为u8, 但是新的.h文件中没有了?有什么特别的原因吗? 我看到的很多工程里面都有用u8, u32定义变量, 如果新版STM32F4xx_DFP.2.9.0.pack包, 更改起来很麻烦.
自己加上两句不就好了,也不用更改,不过我还是比较习惯uint8_t 在新版MDK中, stm32f4xx.h文件是无法修改的, 如果所有.c文件都要用到u8, u32, 岂不得专门建一个.h文件?
另,附上旧版.h文件中的类型定义:
/** @addtogroup Exported_types
* @{
*/
/*!< STM32F10x Standard Peripheral Library old types (maintained for legacy purpose) */
typedef int32_ts32;
typedef int16_t s16;
typedef int8_ts8;
typedef const int32_t sc32;/*!< Read Only */
typedef const int16_t sc16;/*!< Read Only */
typedef const int8_t sc8; /*!< Read Only */
typedef __IO int32_tvs32;
typedef __IO int16_tvs16;
typedef __IO int8_t vs8;
typedef __I int32_t vsc32;/*!< Read Only */
typedef __I int16_t vsc16;/*!< Read Only */
typedef __I int8_t vsc8; /*!< Read Only */
typedef uint32_tu32;
typedef uint16_t u16;
typedef uint8_tu8;
typedef const uint32_t uc32;/*!< Read Only */
typedef const uint16_t uc16;/*!< Read Only */
typedef const uint8_t uc8; /*!< Read Only */
typedef __IO uint32_tvu32;
typedef __IO uint16_t vu16;
typedef __IO uint8_tvu8;
typedef __I uint32_t vuc32;/*!< Read Only */
typedef __I uint16_t vuc16;/*!< Read Only */
typedef __I uint8_t vuc8; /*!< Read Only */
Harry_wu 发表于 2016-8-23 12:03
在新版MDK中, stm32f4xx.h文件是无法修改的, 如果所有.c文件都要用到u8, u32, 岂不得专门建一个.h文件?
另 ...
实在要用可以解锁再改吧 不用另外建.h 这个包老改动,好么? 我也習慣用uin8_t,目前沒問題 自己建了一个TypeDef.h文件, 发上来, 给有需要的人.
/*****************************************************************************
@File name: MyTypeDef.h
@Description:
@Author: Harry Wu
@Version: V1.0
@Date: 2016-8-23
@History:
*****************************************************************************/
#ifndef _MYTYPEDEF_H_
#define _MYTYPEDEF_H_
#include "core_cm4.h" /* Cortex-M4 processor and core peripherals */
#include "system_stm32f4xx.h"
#include <stdint.h>
/** @addtogroup Exported_types
* @{
*/
/*!< STM32F10x Standard Peripheral Library old types (maintained for legacy purpose) */
typedef int32_ts32;
typedef int16_t s16;
typedef int8_ts8;
typedef const int32_t sc32;/*!< Read Only */
typedef const int16_t sc16;/*!< Read Only */
typedef const int8_t sc8; /*!< Read Only */
typedef __IO int32_tvs32;
typedef __IO int16_tvs16;
typedef __IO int8_t vs8;
typedef __I int32_t vsc32;/*!< Read Only */
typedef __I int16_t vsc16;/*!< Read Only */
typedef __I int8_t vsc8; /*!< Read Only */
typedef uint32_tu32;
typedef uint16_t u16;
typedef uint8_tu8;
typedef const uint32_t uc32;/*!< Read Only */
typedef const uint16_t uc16;/*!< Read Only */
typedef const uint8_t uc8; /*!< Read Only */
typedef __IO uint32_tvu32;
typedef __IO uint16_t vu16;
typedef __IO uint8_tvu8;
typedef __I uint32_t vuc32;/*!< Read Only */
typedef __I uint16_t vuc16;/*!< Read Only */
typedef __I uint8_t vuc8; /*!< Read Only */
typedef enum
{
BOOL_FALSE = 0,
BOOL_TRUE= 1
}BOOLEAN;
//typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;
//typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
//#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
//typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
#endif
学习了,谢谢楼主
页:
[1]