esp32-snippets icon indicating copy to clipboard operation
esp32-snippets copied to clipboard

Cant use GPIO, BLE HID doesnt work.

Open JuanJoseMoralesCalvo opened this issue 2 years ago • 1 comments

As simple as that, when i simulate it works good, but when i declare a pinMode and read it, the HID service doesnt work.

Thanks in advance.

JuanJoseMoralesCalvo avatar Oct 10 '22 21:10 JuanJoseMoralesCalvo

@chegewara I know that im just answering myself but if anyone need this i made the workaround like this:

void onConnect(BLEServer* BLEservidor){
            // Respuesta a error de post-emparejamiento ble
            if(digitalRead(17) == 1) //NOT PAIR GPIO17 SHOULD BE 0; PAIR GPIO17 SHOULD BE 1;
            {
            BLEDescriptor *hid_desc = REPORT->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
            uint8_t val[] = {0x01, 0x00};
            hid_desc->setValue(val, 2);
            }                
            device_connected = true;
}

Establishing a NO PAIR MODE (when pin17 == 0) and a PAIR MODE(when pin17==1). I dont have debug evidence but it seems in my case that when the device its NOT PAIR, the first time it connects doesnt recieve the HID Service well with the previous workaround. It will work perfectly when its already PAIR.

JuanJoseMoralesCalvo avatar Oct 11 '22 08:10 JuanJoseMoralesCalvo