可爱的注释

[复制链接]
1892|3
 楼主| celticzy 发表于 2012-9-7 17:04 | 显示全部楼层 |阅读模式
刚看到的,哈哈

  1. #include "stm32f10x.h"
  2. #include "usr_uart.h"


  3. uint8_t USART1_receive_data = 0,USART2_receive_data = 0;

  4. uint8_t USART2_receive_buf1[1024],USART2_receive_buf2[1024];

  5. __IO uint16_t USART2_receive_index=0;  //严重注意:这里一定要至少16位的,晕,找了半天错。

  6. __IO uint8_t USART2_receive_flag1 =0,USART2_receive_flag2 =0;

  7. __IO uint8_t USART2_receive_buf_sel = 1;
阿南 发表于 2012-9-7 17:18 | 显示全部楼层
楼主想问什么问题?
airwill 发表于 2012-9-8 13:38 | 显示全部楼层
注释有些特别, 但是作者很大的教训的体现.
上面的 buf 缓冲区大小达 1024, 如果指针是8位, 当然会出问题咯
aozima 发表于 2012-9-9 00:28 | 显示全部楼层
__IO 在驱动中使用是合理的,应用程序中不建议使用,建议直接使用 volatile
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

18

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部