按照上一篇文章的接口定義連接鼠標標傳感器 paw3395,SDK提供的樣板程序“sel_mouse_with_dongle”能正常工作。
原樣板程序中光標傳感器采用查詢模式工作,所以不需要連接 paw3395 的 motion 引腳。 通過USB工具程序發現鼠標不管有沒有按鍵滾輪和光標數據一直不停的發送數據可以在程序中進行改進具體方法如下
修改程序“…samplespriductssle_mouse_with_donglesle_low_latency_service.c”中 void sle_mouse_get_key(void) 函數
void sle_mouse_get_key(void)
{
int8_t button_mask = 0;
int16_t x = 0;
int16_t y = 0;
int8_t wheel = 0;
sle_mouse_key_set(&button_mask, &x, &y, &wheel);
if(sle_mouse_data_is_empty(button_mask, x, y, wheel))
{ //
return;
}
g_mouse_notify_data.button_mask = button_mask;
g_mouse_notify_data.x = x;
g_mouse_notify_data.y = y;
g_mouse_notify_data.wheel = wheel;
g_ssap_notify_data.handle = SLE_MOUSE_SSAP_RPT_HANDLE;
g_ssap_notify_data.type = 0;
g_ssap_notify_data.value_len = sizeof(ssap_mouse_key_t);
g_ssap_notify_data.value = (uint8_t *)(&g_mouse_notify_data);
ssaps_notify_indicate(SLE_MOUSE_DEFAULT_SERVER_ID, SLE_MOUSE_DEFAULT_CONNECT_ID, &g_ssap_notify_data);
}
添加了空數據判斷,如果為空直接 return; 。
空數據判斷程序如下
static bool sle_mouse_data_is_empty(int8_t buttons, int16_t x, int16_t y, int8_t wheel)
{
if((!buttons) && (!x) && (!y) && (!wheel))
return true;
else
return false;
}
再次燒錄測試 一切正常。
審核編輯:湯梓紅
-
華為
+關注
關注
216文章
34532瀏覽量
252991 -
程序
+關注
關注
117文章
3795瀏覽量
81406 -
開發板
+關注
關注
25文章
5121瀏覽量
98189 -
SDK
+關注
關注
3文章
1045瀏覽量
46267 -
星閃
+關注
關注
7文章
123瀏覽量
687
發布評論請先 登錄
相關推薦
如何搭建星閃BS25開發環境
![如何搭建<b class='flag-5'>星</b><b class='flag-5'>閃</b><b class='flag-5'>BS25</b><b class='flag-5'>開發</b>環境](https://file1.elecfans.com/web2/M00/B0/DF/wKgZomVYgKaABrx3AAAxAPrXgbQ655.png)
評論