历史上的今天
今天是:2024年09月24日(星期二)
2019年09月24日 | STM32库USART_ITConfig的坑
2019-09-24 来源:eefocus
USART_ITConfig只能使用一个中断标志!
看看中断参数的定义:
#define USART_IT_PE ((uint16_t)0x0028)
#define USART_IT_TXE ((uint16_t)0x0727)
#define USART_IT_TC ((uint16_t)0x0626)
#define USART_IT_RXNE ((uint16_t)0x0525)
#define USART_IT_ORE_RX ((uint16_t)0x0325) /* In case interrupt is generated if the RXNEIE bit is set */
#define USART_IT_IDLE ((uint16_t)0x0424)
#define USART_IT_LBD ((uint16_t)0x0846)
#define USART_IT_CTS ((uint16_t)0x096A)
#define USART_IT_ERR ((uint16_t)0x0060)
#define USART_IT_ORE_ER ((uint16_t)0x0360) /* In case interrupt is generated if the EIE bit is set */
#define USART_IT_NE ((uint16_t)0x0260)
#define USART_IT_FE ((uint16_t)0x0160)
如果你一不小心使用了或运算施工图配置多个中断,而又没有打开断言开关的宏,恐怕你会痛苦一阵子了!
在stm32f4xx_conf.h中,打开标志并定义函数
#define USE_FULL_ASSERT 1
void assert_failed(uint8_t *file, uint32_t line);
/* Uncomment the line below to expanse the "assert_param" macro in the
Standard Peripheral Library drivers code */
#define USE_FULL_ASSERT 1
/* Exported macro ------------------------------------------------------------*/
#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 */
void assert_failed(uint8_t *file, uint32_t line);
void assert_failed(uint8_t *file, uint32_t line);
史海拾趣
|
好不容易盼到这里啦! 这里我们一起来分享一下二维图形的绘制和修饰 对数坐标图,极坐标图 饼状图,梯形图,概率分布图,向量图等等的二维图形 如果你觉得不过瘾, 我们接着来三维图形 甚至是GUI的界面都可以的啦! 期待大家的帮助拉!… 查看全部问答> |
|
我用的是DDK里的打印成位图驱动。并对OEMSendPage进行了Hook。主要是想把位图按页分成多个图片。当我打印多页时(以5页为例),在第一页插入一张图片,结果只打印后2,3,4,5页。当每页都插入图片,则只是打印成一张长长的位图(又回到了原始的DDK ...… 查看全部问答> |
|
我是新手,最近在编一个程序需要用到捕获单元,但有一点想不清楚,就是我需要在第一次捕获时屏蔽中断,第二次捕获后响应中断,从而读出这两个的差值,但程序应该怎么编写呢。感谢指点!… 查看全部问答> |
|
谁遇到过SIM300,接受TCP数据后,串口读取数据时,发现数据丢失情况 谁遇到过SIM300,接受TCP数据后,串口读取数据时,发现数据丢失情况~~~急啊~~~高手解答一下啊~~急~!!!… 查看全部问答> |




