Discuz! Board

标题: uart 串口通信例程问题 [打印本页]

作者: gasonchen    时间: 2017-2-24 14:04
标题: uart 串口通信例程问题
请问青风开发板在运行,UART串口通信实验时,长按,BUTTON_0 时,程序会自动复位,原因是什么??谁遇到过??


作者: admin    时间: 2017-2-24 17:49
不会吧、

作者: gasonchen    时间: 2017-3-6 17:42
我把button_0 对应电路上的IO 16,在程序上修改:#define BUTTON_1       16。然后长按button_0,程序会复位。
作者: gasonchen    时间: 2017-3-8 09:04
终于找到原因了。
原来是官方例程中,使用了button_0和button_1.
分别在两函数初始配置,将其屏蔽即解决问题了。
**@brief Function for configuring the buttons for advertisement.
*
* @retval NRF_SUCCESS  Configured successfully.
* @return A propagated error code.
*/
static uint32_t advertising_buttons_configure()
{

    uint32_t err_code;

    err_code = bsp_event_to_button_action_assign(BTN_ID_DISCONNECT,
                                                 BTN_ACTION_DISCONNECT,
                                                 BSP_EVENT_DEFAULT);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    err_code = bsp_event_to_button_action_assign(BTN_ID_WHITELIST_OFF,
                                                 BTN_ACTION_WHITELIST_OFF,
                                                 BSP_EVENT_WHITELIST_OFF);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    err_code = bsp_event_to_button_action_assign(BTN_ID_SLEEP,
                                                 BTN_ACTION_SLEEP,
                                                 BSP_EVENT_SLEEP);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    return NRF_SUCCESS;
}
static uint32_t connection_buttons_configure()
{
       
    uint32_t err_code;

    err_code = bsp_event_to_button_action_assign(BTN_ID_SLEEP,
                                                 BTN_ACTION_SLEEP,
                                                 BSP_EVENT_DEFAULT);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    err_code = bsp_event_to_button_action_assign(BTN_ID_WHITELIST_OFF,
                                                 BTN_ACTION_WHITELIST_OFF,
                                                 BSP_EVENT_WHITELIST_OFF);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    err_code = bsp_event_to_button_action_assign(BTN_ID_DISCONNECT,
                                                 BTN_ACTION_DISCONNECT,
                                                 BSP_EVENT_DISCONNECT);
    RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);

    return NRF_SUCCESS;
}





欢迎光临 Discuz! Board (http://www.qfv8.com/) Powered by Discuz! X3