Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Bluefruit NRF52832 and NRF52840 no longer working to emulate
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Bluefruit NRF52832 and NRF52840 no longer working to emulate

by johncohn on Thu Jul 23, 2020 10:38 pm

Folks,
for the last several weeks I've been successfully emulating a mouse for an iPad using the hid-mouse features of a bluefruit NRF52832 and NRF52840. Today I had to upgrade to iOS 13.3 on my iPad and now neither of the chips now can emulate a mouse. Instead I get the following message when poor.. and the iPad mouse features do not work

using "Bluefruit52) may effect Wifi and Bluetooth connectivity:


The mouse still works with an official Apple "magic mouse" . This post on reddit a couple of days ago seems to imply that Apple may be trying to limit use of these new mouse features to their own products… (Ugh).

https://www.reddit.com/r/iPadOS/comment ... _wifi_and/

Does anyone know why the bluefruit code would suddenly stop working like this? More importantly Any thoughts on what I need to do in the Bluetooth set up to get this working again? I'm kind of desperate as this is part of a major product demonstration we're doing. Any help so very appreciate it!
-jc

ps. I can demonstrate this problem using the stock example HID mouse code that comes with bluefruit. I'll include it here just for completeness

Code: Select all | TOGGLE FULL SIZE
/*********************************************************************
This is an example for our nRF52 based Bluefruit LE modules

Pick one up today in the adafruit shop!

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

MIT license, check LICENSE for more information
All text above, and the splash screen below must be included in
any redistribution
*********************************************************************/
#include <bluefruit.h>

BLEDis bledis;
BLEHidAdafruit blehid;

#define MOVE_STEP    10

void setup()
{
  Serial.begin(115200);
  while ( !Serial ) delay(10);   // for nrf52840 with native usb

  Serial.println("Bluefruit52 HID Mouse Example");
  Serial.println("-----------------------------\n");
  Serial.println("Go to your phone's Bluetooth settings to pair your device");
  Serial.println("then open an application that accepts mouse input");
  Serial.println();

  Serial.println("Enter following characters");
  Serial.println("- 'WASD'  to move mouse (up, left, down, right)");
  Serial.println("- 'LRMBF' to press mouse button(s) (left, right, middle, backward, forward)");
  Serial.println("- 'X'     to release mouse button(s)");

  Bluefruit.begin();
  // HID Device can have a min connection interval of 9*1.25 = 11.25 ms
  Bluefruit.Periph.setConnInterval(9, 16); // min = 9*1.25=11.25 ms, max = 16*1.25=20ms
  Bluefruit.setTxPower(4);    // Check bluefruit.h for supported values
  Bluefruit.setName("Bluefruit52");

  // Configure and Start Device Information Service
  bledis.setManufacturer("Adafruit Industries");
  bledis.setModel("Bluefruit Feather 52");
  bledis.begin();

  // BLE HID
  blehid.begin();

  // Set up and start advertising
  startAdv();
}

void startAdv(void)
{  
  // Advertising packet
  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
  Bluefruit.Advertising.addTxPower();
  Bluefruit.Advertising.addAppearance(BLE_APPEARANCE_HID_MOUSE);
  
  // Include BLE HID service
  Bluefruit.Advertising.addService(blehid);

  // There is enough room for 'Name' in the advertising packet
  Bluefruit.Advertising.addName();
  
  /* Start Advertising
   * - Enable auto advertising if disconnected
   * - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
   * - Timeout for fast mode is 30 seconds
   * - Start(timeout) with timeout = 0 will advertise forever (until connected)
   *
   * For recommended advertising interval
   * https://developer.apple.com/library/content/qa/qa1931/_index.html   
   */
  Bluefruit.Advertising.restartOnDisconnect(true);
  Bluefruit.Advertising.setInterval(32, 244);    // in unit of 0.625 ms
  Bluefruit.Advertising.setFastTimeout(30);      // number of seconds in fast mode
  Bluefruit.Advertising.start(0);                // 0 = Don't stop advertising after n seconds  
}

void loop()
{    
  if (Serial.available())
  {
    char ch = (char) Serial.read();

    // convert to upper case
    ch = (char) toupper(ch);
    
    // echo
    Serial.println(ch);
  
    switch(ch)
    {
      // WASD to move the mouse
      case 'W':
        blehid.mouseMove(0, -MOVE_STEP);
      break;

      case 'A':
        blehid.mouseMove(-MOVE_STEP, 0);
      break;

      case 'S':
        blehid.mouseMove(0, MOVE_STEP);
      break;

      case 'D':
        blehid.mouseMove(MOVE_STEP, 0);
      break;

      // LRMBF for mouse button(s)
      case 'L':
        blehid.mouseButtonPress(MOUSE_BUTTON_LEFT);
      break;

      case 'R':
        blehid.mouseButtonPress(MOUSE_BUTTON_RIGHT);
      break;

      case 'M':
        blehid.mouseButtonPress(MOUSE_BUTTON_MIDDLE);
      break;

      case 'B':
        blehid.mouseButtonPress(MOUSE_BUTTON_BACKWARD);
      break;

      case 'F':
        // This key is not always supported by every OS
        blehid.mouseButtonPress(MOUSE_BUTTON_FORWARD);
      break;

      case 'X':
        // X to release all buttons
        blehid.mouseButtonRelease();
      break;

      default: break;
    }
  }
}


johncohn
 
Posts: 20
Joined: Wed Apr 13, 2011 9:59 am

Please be positive and constructive with your questions and comments.