Chinaunix首页 | 论坛 | 博客
  • 博客访问: 56662
  • 博文数量: 27
  • 博客积分: 580
  • 博客等级: 中士
  • 技术积分: 265
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-02 09:55
个人简介

做真实的自己!

文章分类
文章存档

2015年(1)

2014年(1)

2013年(8)

2012年(8)

2011年(1)

2010年(8)

我的朋友

分类: C/C++

2012-01-09 09:44:14

1、__I __O __IO的定义来自于core_cm3.h
/**
 * IO definitions
 *
 * define access restrictions to peripheral registers
 */
#ifdef __cplusplus
  #define     __I     volatile                /*!< defines 'read only' permissions      */
#else
  #define     __I     volatile const          /*!< defines 'read only' permissions      */
#endif
#define     __O     volatile                  /*!< defines 'write only' permissions     */
#define     __IO    volatile                  /*!< defines 'read / write' permissions   */
2、编译提示assert_param出错之后定义USE_STDPERIPH_DRIVER就能解决的原因。
3、IS_GPIO_ALL_PERIPH IS_GPIO_MODE IS_GPIO_PIN定义出自文件stm32f10x_gpio.h
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));
assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin)); 
 
#define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
                                    ((PERIPH) == GPIOB) || \
                                    ((PERIPH) == GPIOC) || \
                                    ((PERIPH) == GPIOD) || \
                                    ((PERIPH) == GPIOE) || \
                                    ((PERIPH) == GPIOF) || \
                                    ((PERIPH) == GPIOG))
 
#define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_Speed_10MHz) || ((SPEED) == GPIO_Speed_2MHz) || \
                              ((SPEED) == GPIO_Speed_50MHz))
#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_Mode_AIN) || ((MODE) == GPIO_Mode_IN_FLOATING) || \
                            ((MODE) == GPIO_Mode_IPD) || ((MODE) == GPIO_Mode_IPU) || \
                            ((MODE) == GPIO_Mode_Out_OD) || ((MODE) == GPIO_Mode_Out_PP) || \
                            ((MODE) == GPIO_Mode_AF_OD) || ((MODE) == GPIO_Mode_AF_PP))
 
assert_param实际是一个宏定义,出自于stm32f10x_conf.h
#ifdef  USE_FULL_ASSERT
/**
  * @brief  The assert_param macro is used for function's parameters check.
  * @param  expr: If expr is false, it calls assert_failed function which reports
  *         the name of the source file and the source line number of the call
  *         that failed. If expr is true, it returns no value.
  * @retval None
  */
  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
  void assert_failed(uint8_t* file, uint32_t line);
#else
  #define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
阅读(2006) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~