连续签到天数:1天 | 签到总天数:15天 | 签到总奖励:87金币 |
|
马上注册,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
×
小弟我安装ADK3.5后,运行目录下的apps\tutorials\buttons\part1实例,可以运行,但是检测不到button事件,各位高手帮忙看看,附上代码:- /* Copyright Cambridge Silicon Radio Limited 2008-2014 */
- /* Part of BlueLab-6.5.2-Release */
- /*
- * Buttons Tutorial: Part 1 - PIO messages
- */
- #include <pio.h>
- #include <stdio.h>
- #include <message.h>
- #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 */
- typedef struct
- {
- TaskData task; /* task is required for messages to be delivered */
- } appState;
- appState app;
- /* Function prototypes */
- static void app_handler(Task task, MessageId id, Message message);
- static void handle_pio(Task task, MessagePioChanged *pio);
- int main(void)
- {
- /* Set app_handler() function to handle app's messages */
- app.task.handler = app_handler;
- /* Set app task to receive PIO messages */
- MessagePioTask(&app.task);
- /* Setup PIO interrupt messages */
- PioDebounce32(BUTTON_A | BUTTON_B, /* PIO pins we are interested in */
- 2, 20); /* 2 reads and 20ms between them */
- MessageLoop();
-
- return 0;
- }
- static void app_handler(Task task, MessageId id, Message message)
- {
- switch (id)
- {
- case MESSAGE_PIO_CHANGED:
- handle_pio(task, (MessagePioChanged*)message);
- break;
- default:
- printf("Unhandled message 0x%x\n", id);
- }
- }
- static void handle_pio(Task task, MessagePioChanged *pio)
- {
- if (pio->state & BUTTON_A) printf("Button A pressed\n");
- if (pio->state & BUTTON_B) printf("Button B pressed\n");
- }
- /* End-of-File */
复制代码
|
|