XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX 作 者:ZHS(文化人)
XX 联系方式:文章末尾Chat快问(或进群:471144274)
XX 版权声明:原创文章,欢迎评论和转载~转载时能告诉我一声就最好了
XX 要说的话:作者水平有限,难免有不足之处,恳请指正!
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
文章索引1:https://blog.csdn.net/Augusdi/article/details/4177221
文章索引2:https://blog.csdn.net/dfysy/article/details/5914863
文章索引3:https://blog.csdn.net/weixin_40204595/article/details/81179361
文章索引4:https://devzone.nordicsemi.com/f/nordic-q-a/7703/what-can-i-do-if-i-want-to-send-left-or-right-button-data
1、目的:
在鼠标移动的例程中,实现鼠标的左右中按键;
2、平台:
SDK版本:SDK_12.2.0
硬件平台:艾克姆nRF52832开发板
官方例程:examples\ble_peripheral\ble_app_hids_mouse\pca10040\s132\arm5_no_packs
3、步骤:
static void mouse_buttons_send(int8_t click, int8_t wheel, int8_t pan)
{
uint32_t err_code;
uint8_t buffer[INPUT_REP_BUTTONS_LEN];
APP_ERROR_CHECK_BOOL(INPUT_REP_BUTTONS_LEN == 3);
NRF_LOG_INFO("mouse_buttons_send\r\n");
buffer[0] = click;
buffer[1] = wheel;
buffer[2] = pan;
err_code = ble_hids_inp_rep_send(&m_hids, INPUT_REP_BUTTONS_INDEX, INPUT_REP_BUTTONS_LEN, buffer);
if ((err_code != NRF_SUCCESS) &&
(err_code != NRF_ERROR_INVALID_STATE) &&
(err_code != BLE_ERROR_NO_TX_PACKETS) &&
(err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
)
{
APP_ERROR_HANDLER(err_code);
}
}
mouse_buttons_send(1, 0, 0);//left
mouse_buttons_send(2, 0, 0);//right
mouse_buttons_send(4, 0, 0);//middle
mouse_buttons_send(0, 0, 0);//cancel