STM32 問題解決單

USE_STDPERIPH_DRIVER, 若果不定義這個宏的報錯

..\OBJ\application.axf: Error: L6218E: Undefined symbol assert_param (referred from misc.o).

查看這個宏定義的作用如下:

可以看到出沒有宏,那麼底層文件stm32f10x.h是無法調用stm32f10x——conf.h文件的,

所以要添宏 如下圖;

在STM32f10x.h 文件中的一些常用 結構體 

u32     a; //定義32位無符號變量
u16     a; //定義16位無符號變量
u8     a; //定義8位無符號變量
vu32     a; //定義易變32位無符號變量
vu16     a; //定義易變16位無符號變量
vu8     a; //定義易變8位無符號變量
uc32     a; //定義只讀32位無符號變量
uc16     a; //定義只讀16位無符號變量
uc8     a; //定義只讀8位無符號變量

//stdint.h 文件 重新定義了變量名
typedef   signed          char int8_t;
typedef   signed short     int int16_t;
typedef   signed           int int32_t;
typedef   signed       __INT64 int64_t;

    /* exact-width unsigned integer types */
typedef unsigned          char uint8_t;
typedef unsigned short     int uint16_t;
typedef unsigned           int uint32_t;
typedef unsigned       __INT64 uint64_t;
     ..................................................
           ...............好多的!


//stm32f10x.h 文件
typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;


//stm32f10x_gpio.h 文件
typedef enum
{ Bit_RESET = 0,
  Bit_SET
}BitAction;

//stm32f10x_exti.h 文件 中斷配置結構體
typedef struct
{
  uint32_t EXTI_Line;               /*!< Specifies the EXTI lines to be enabled or disabled.
                                         This parameter can be any combination of @ref EXTI_Lines */
   
  EXTIMode_TypeDef EXTI_Mode;       /*!< Specifies the mode for the EXTI lines.
                                         This parameter can be a value of @ref EXTIMode_TypeDef */

  EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
                                         This parameter can be a value of @ref EXTIMode_TypeDef */

  FunctionalState EXTI_LineCmd;     /*!< Specifies the new state of the selected EXTI lines.
                                         This parameter can be set either to ENABLE or DISABLE */ 
}EXTI_InitTypeDef;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章