Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- hidapp.orig.c Thu Aug 15 14:28:40 2013
- +++ hidapp.c Tue Jun 06 07:50:01 2017
- @@ -478,6 +478,32 @@
- return ( 0 ); /* Discard unknown events. */
- }
- +#define HAL_KEY_CODE_NOKEY 0xFF
- +#define HID_KEYBOARD_IN_RPT_LEN 8
- +#define KEY_NONE 0x00
- +#define HID_KEYBOARD_RESERVED 0 // 0x00 - No event inidicated
- +
- +static void hidEmuKbdSendReport( uint8 modifiers, uint8 keycode ) {
- + uint8 buf[HID_KEYBOARD_IN_RPT_LEN];
- +
- + // No need to include Report Id
- + buf[0] = modifiers; // Modifier keys
- + buf[1] = 0; // Reserved
- + buf[2] = keycode; // Keycode 1
- + buf[3] = 0; // Keycode 2
- + buf[4] = 0; // Keycode 3
- + buf[5] = 0; // Keycode 4
- + buf[6] = 0; // Keycode 5
- + buf[7] = 0; // Keycode 6
- +
- + gattMsgEvent_t tPkt;
- + tPkt.method = ATT_HANDLE_VALUE_NOTI;
- + tPkt.msg.handleValueNoti.len = 8;
- + tPkt.msg.handleValueNoti.handle = keyCharHandle;
- + for (int i=0; i<8; i++) tPkt.msg.handleValueNoti.value[i] = buf[i];
- + hidappProcessGATTMsg(&tPkt);
- +}
- +
- /*********************************************************************
- *
- * @fn hidappHandleKey
- @@ -496,6 +522,12 @@
- if (keys & HAL_KEY_SW_1)
- {
- + hidEmuKbdSendReport( 0x80, KEY_NONE ); // winkey
- + hidEmuKbdSendReport( 0, KEY_NONE );
- +
- + static uint8 led = 1;
- + HalLedSet( HAL_LED_2, led ? HAL_LED_MODE_ON : HAL_LED_MODE_OFF );
- + led = !led;
- // If bonds exist, erase all of them
- if ( ( hidappBondCount() > 0 ) && ( hidappBLEState != BLE_STATE_CONNECTED ) )
- {
- @@ -520,7 +552,7 @@
- {
- #if defined ( NANO_DONGLE )
- - HalLedSet( HAL_LED_2, HAL_LED_MODE_OFF ); // red led
- + //HalLedSet( HAL_LED_2, HAL_LED_MODE_OFF ); // red led
- // Notify our task to start initial discovey
- osal_set_event( hidappTaskId, HIDAPP_EVT_START_DISCOVERY );
- @@ -816,7 +848,7 @@
- return ( FALSE );
- }
- - HalLedSet( HAL_LED_2, HAL_LED_MODE_BLINK );
- + //HalLedSet( HAL_LED_2, HAL_LED_MODE_BLINK );
- return ( hidSendHidInReport(pNoti->value, endPoint, pNoti->len) );
- }
- @@ -1058,7 +1090,7 @@
- {
- if ( hidappBLEState == BLE_STATE_SCANNING )
- {
- - HalLedSet( HAL_LED_2, HAL_LED_MODE_BLINK ); // red led
- + //HalLedSet( HAL_LED_2, HAL_LED_MODE_BLINK ); // red led
- // Begin scanning
- VOID GAPCentralRole_StartDiscovery( DEFAULT_DISCOVERY_MODE,
- @@ -1079,8 +1111,7 @@
- static void hidappSetIdle( void )
- {
- hidappBLEState = BLE_STATE_IDLE;
- -
- - HalLedSet( HAL_LED_2, HAL_LED_MODE_ON ); // red led
- + //HalLedSet( HAL_LED_2, HAL_LED_MODE_ON ); // red led
- }
- /*********************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement