找回密码
 立即注册

使用微信账号登录

只需一步,快速开始

查看: 3819|回复: 1

[CSR8系列] CSR8670 ADK3.5中自带的button(part1)实例运行无法检测button事件,求原因

[复制链接]
连续签到天数:1天
签到总天数:15天
签到总奖励:87金币
发表于 2015-4-17 15:38:39 | 显示全部楼层 |阅读模式

马上注册,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册  

×
小弟我安装ADK3.5后,运行目录下的apps\tutorials\buttons\part1实例,可以运行,但是检测不到button事件,各位高手帮忙看看,附上代码:
  1. /* Copyright Cambridge Silicon Radio Limited 2008-2014 */
  2. /* Part of BlueLab-6.5.2-Release */

  3. /*
  4. * Buttons Tutorial: Part 1 - PIO messages
  5. */

  6. #include <pio.h>
  7. #include <stdio.h>
  8. #include <message.h>

  9. #define BUTTON_A        (1 << 0)        /* PIO0 is BUTTON_A */
  10. #define BUTTON_B        (1 << 1)        /* PIO1 is BUTTON_B */
  11. #define BUTTON_C        (1 << 2)        /* PIO2 is BUTTON_C */
  12. #define BUTTON_D        (1 << 3)        /* PIO3 is BUTTON_D */

  13. typedef struct
  14. {
  15.     TaskData    task;   /* task is required for messages to be delivered */
  16. } appState;

  17. appState app;

  18. /* Function prototypes */
  19. static void app_handler(Task task, MessageId id, Message message);
  20. static void handle_pio(Task task, MessagePioChanged *pio);

  21. int main(void)
  22. {
  23.     /* Set app_handler() function to handle app's messages */
  24.     app.task.handler = app_handler;

  25.     /* Set app task to receive PIO messages */
  26.     MessagePioTask(&app.task);

  27.     /* Setup PIO interrupt messages */
  28.     PioDebounce32(BUTTON_A | BUTTON_B,  /* PIO pins we are interested in */
  29.                 2, 20);                 /* 2 reads and 20ms between them */

  30.     MessageLoop();
  31.    
  32.     return 0;
  33. }

  34. static void app_handler(Task task, MessageId id, Message message)
  35. {
  36.     switch (id)
  37.     {
  38.     case MESSAGE_PIO_CHANGED:
  39.         handle_pio(task, (MessagePioChanged*)message);
  40.         break;

  41.     default:
  42.         printf("Unhandled message 0x%x\n", id);
  43.     }
  44. }

  45. static void handle_pio(Task task, MessagePioChanged *pio)
  46. {
  47.     if (pio->state & BUTTON_A) printf("Button A pressed\n");
  48.     if (pio->state & BUTTON_B) printf("Button B pressed\n");   
  49. }

  50. /* End-of-File */
复制代码



楼主热帖
积分商城 - 让您的金币更有价值!||官方Q群 - 让您的沟通更加及时!
连续签到天数:1天
签到总天数:45天
签到总奖励:1237金币
发表于 2017-5-12 07:37:44 | 显示全部楼层
你的按键不是连接在PIO0,1,2,3上吧,你看一下你的电路图,把对应的pio改一下应该可以
#define BUTTON_A        (1 << 0)        /* PIO0 is BUTTON_A */
#define BUTTON_B        (1 << 1)        /* PIO1 is BUTTON_B */
#define BUTTON_C        (1 << 2)        /* PIO2 is BUTTON_C */
#define BUTTON_D        (1 << 3)        /* PIO3 is BUTTON_D */
就是这个

积分商城 - 让您的金币更有价值!||官方Q群 - 让您的沟通更加及时!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册  

本版积分规则

小黑屋|手机版|我爱蓝牙网 - 52Bluetooth

GMT+8, 2024-4-29 15:25 , Processed in 0.192259 second(s), 13 queries , Gzip On, MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表