I develop RF Remote Control with nRFready Smart Remote.
nRFready Smart Remote Feature:
- Remote Control : nRF24LE1 (MCU + RF) -> Device
- USB dongle : nRF24LU1+ (MCU + RF + USB) -> Host
I am trying to send mouse right-click event from Remote Control to USB dongle.
(1) Remote Control
I send a data through PIPE_TOUCH. The data format was defined in the Smart Remote Firmware documentation.
[ Total 7 Bytes ]
-
Finger 0 X delta : 1 Byte
-
Finger 0 Y delta : 1 Byte
-
Finger present Button/LED Status : 1 Byte
-
Gesture flags 0 : 1 Byte
-
Gesture flags 1 : 1 Byte
-
Scroll zone 1 : 1 Byte
-
Scroll zone 2 : 1 Byte
For exameple, it works well in case of mouse left-click event.
0 (X)
0 (Y)
1 (any) (Button/LED Status)
0x08 (Gesture flags 0)
0 (Gesture flags 1)
0 (Scroll zone 1)
0 (Scroll zone 2)
unsigned char TestMouseRF_nRF24LE1 (char s8X, char s8Y, unsigned char u8ButtonStatus, unsigned char u8Gesture0, unsigned char u8Gesture1) {
unsigned char tx_buf[7];
unsigned char i = 0;
unsigned char u8Ret = 0;
// (1) buffer zero
for (i = 0; i < sizeof(tx_buf); i++)
{
tx_buf[i] = 0;
}
// (2) set value
tx_buf[0] = s8X;
tx_buf[1] = s8Y;
tx_buf[2] = u8ButtonStatus;
tx_buf[3] = u8Gesture0;
tx_buf[4] = u8Gesture1;
// (3) send
u8Ret = gzll_tx_data(tx_buf, sizeof(tx_buf), PIPE_TOUCHPAD);
// (4) check and reset
SetTxAttempted(1);
g_u16UserActivityCount = 0;
return u8Ret;
}
But I have a problem to send mouse right-click event.
For example, mouse right-click
0 (X)
0 (Y)
1 (any) (Button/LED Status)
0x10 (Gesture flags 0)
0 (Gesture flags 1)
0 (Scroll zone 1)
0 (Scroll zone 2)
(2) USB dongle
Nordic example source "projects\nRFready_2_4_GHz_RF_Smart_Remote\dongle\main.c"
I could see repack_mouse_packet function.
It did not define about mouse right-click.
enum TapType {Press = BIT_5,
EarlyTap = BIT_3,
DoubleTap = BIT_2,
TapAndHold = BIT_1,
SingleTap = BIT_0,
NoTap = 0};
I modified it.
enum TapType {Press = BIT_5,
RightTap = BIT_4,
EarlyTap = BIT_3,
DoubleTap = BIT_2,
TapAndHold = BIT_1,
SingleTap = BIT_0,
NoTap = 0};
(...)
if (input_buffer[3] & EarlyTap)
{
mouse_btn = true;
button_packet[MOUSE_BUTTONS] = 0x01;
}
else if( input_buffer[3] & RightTap )
{
mouse_btn = true;
button_packet[MOUSE_BUTTONS] = 0x02;
}
(...)
I downloaded and run but it did not work mouse right-click event.
I read USB HID Version 1.11 and 1.2.
I saw mouse Report Map(mouse_report_desc.h).
I have 2 problems.
First, I cannot find data format of mouse in Remote Control(Device).
- Finger 0 X delta : 1 Byte
- Finger 0 Y delta : 1 Byte
- Finger present Button/LED Status : 1 Byte
- Gesture flags 0 : 1 Byte
- Gesture flags 1 : 1 Byte
- Scroll zone 1 : 1 Byte
- Scroll zone 2 : 1 Byte
Finger present Button/LED Status <== what does each bitmask mean?
Gesture flags 0, Gesture 1 <=== what does each bitmask mean?
Second, I cannot find data format of mouse in USB dongle(Host).
enum TapType {Press = BIT_5,
EarlyTap = BIT_3,
DoubleTap = BIT_2,
TapAndHold = BIT_1,
SingleTap = BIT_0,
NoTap
button_packet[MOUSE_BUTTONS] <=== what does each bitmask mean? why does not it define about mouse right-click?
USB HID 12v2, Button Page (0x09) (pg 67), Table 14. Button Usage Page
-
Button 1 : 1
-
Button 2 : 2
-
...
(...)
else if( input_buffer[3] & RightTap ) {
mouse_btn = true; button_packet[MOUSE_BUTTONS] = 0x02;
}
(...)
Thanks in advance.