Merge branch 'master' of github.com:adafruit/Adafruit_nRF52_Arduino
This commit is contained in:
commit
d41cc16ed2
3 files changed
+26
-26
No files matched your search
@@ -16,7 +16,7 @@
|
||||
|
||||
BLEUart bleuart;
|
||||
|
||||
// function prototypes over in packetparser.cpp
|
||||
// Function prototypes for packetparser.cpp
|
||||
uint8_t readPacket(BLEUart *ble_uart, uint16_t timeout);
|
||||
float parsefloat(uint8_t *buffer);
|
||||
void printHex(const uint8_t * data, const uint32_t numBytes);
|
||||
@@ -34,7 +34,7 @@ extern uint8_t packetbuffer[];
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(F("Adafruit Bluefruit52 App Controller Example"));
|
||||
Serial.println(F("Adafruit Bluefruit52 Controller App Example"));
|
||||
Serial.println(F("-------------------------------------------"));
|
||||
|
||||
Bluefruit.begin();
|
||||
@@ -43,7 +43,7 @@ void setup(void)
|
||||
// Configure and Start BLE Uart Service
|
||||
bleuart.start();
|
||||
|
||||
// Set up Advertising Packet
|
||||
// Set up the advertising packet
|
||||
setupAdv();
|
||||
|
||||
// Start Advertising
|
||||
|
||||
@@ -26,8 +26,8 @@ void setup()
|
||||
Serial.println("Bluefruit52 HID Keyboard Example");
|
||||
|
||||
Bluefruit.begin();
|
||||
// HID Device can have min connection interval up to 9*1.25 = 11.25 ms
|
||||
Bluefruit.setConnInterval(9, 16); // min = 11.25 ms, max = 20ms
|
||||
// HID Device can have a min connection interval of 9*1.25 = 11.25 ms
|
||||
Bluefruit.setConnInterval(9, 16); // min = 9*1.25=11.25 ms, max = 16*1.25=20ms
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Configure and Start Device Information Service
|
||||
@@ -40,10 +40,10 @@ void setup()
|
||||
// Configure and Start BLE Uart Service
|
||||
bleuart.start();
|
||||
|
||||
// BLE Hid
|
||||
// BLE HID
|
||||
blehid.start();
|
||||
|
||||
// Set up Advertising Packet
|
||||
// Setup Advertising Packet
|
||||
setupAdv();
|
||||
|
||||
// Start Advertising
|
||||
@@ -57,17 +57,17 @@ void setupAdv(void)
|
||||
|
||||
Bluefruit.addAdvApperance(BLE_APPEARANCE_HID_KEYBOARD);
|
||||
|
||||
// Include ble hid service
|
||||
// Include BLE HID service
|
||||
Bluefruit.addAdvService(blehid);
|
||||
|
||||
// There is enough room for Name in Advertising packet
|
||||
// There is enough room for the dev name in the advertising packet
|
||||
Bluefruit.addAdvName();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Only send KeyRelease if previously pressed, to avoid sending
|
||||
// multiple keyRelease report (that consume memories and bandwidth)
|
||||
// Only send KeyRelease if previously pressed to avoid sending
|
||||
// multiple keyRelease reports (that consume memory and bandwidth)
|
||||
if ( hasKeyPressed )
|
||||
{
|
||||
hasKeyPressed = false;
|
||||
@@ -75,7 +75,7 @@ void loop()
|
||||
|
||||
blehid.consumerKeyRelease();
|
||||
|
||||
// delay a bit after a report
|
||||
// Delay a bit after a report
|
||||
delay(5);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void loop()
|
||||
{
|
||||
char ch = (char) Serial.read();
|
||||
|
||||
// ehco
|
||||
// echo
|
||||
Serial.write(ch);
|
||||
|
||||
blehid.keyPress(ch);
|
||||
@@ -91,7 +91,7 @@ void loop()
|
||||
|
||||
blehid.consumerKeyPress(HID_USAGE_CONSUMER_MUTE);
|
||||
|
||||
// delay a bit after a report
|
||||
// Delay a bit after a report
|
||||
delay(5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ void setup()
|
||||
Serial.begin(115200);
|
||||
|
||||
Serial.println("Bluefruit52 HID Mouse Example");
|
||||
Serial.println("- Enter 'WASD' for move mouse (up, left, down, right)");
|
||||
Serial.println("- Enter 'LRMBF' for pressing mouse buttons (left, right, middle, backward, forward)");
|
||||
Serial.println("- Enter 'X' for releasing mouse buttons");
|
||||
Serial.println("- Enter 'WASD' to move mouse (up, left, down, right)");
|
||||
Serial.println("- Enter 'LRMBF' to press mouse button(s) (left, right, middle, backward, forward)");
|
||||
Serial.println("- Enter 'X' to release mouse button(s)");
|
||||
|
||||
Bluefruit.begin();
|
||||
// HID Device can have min connection interval up to 9*1.25 = 11.25 ms
|
||||
Bluefruit.setConnInterval(9, 16); // min = 11.25 ms, max = 20ms
|
||||
// HID Device can have a min connection interval of 9*1.25 = 11.25 ms
|
||||
Bluefruit.setConnInterval(9, 16); // min = 9*1.25=11.25 ms, max = 16*1.25=20ms
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
// Configure and Start Device Information Service
|
||||
@@ -43,7 +43,7 @@ void setup()
|
||||
// Configure and Start BLE Uart Service
|
||||
bleuart.start();
|
||||
|
||||
// BLE Hid
|
||||
// BLE HID
|
||||
blehid.start();
|
||||
|
||||
// Set up Advertising Packet
|
||||
@@ -60,10 +60,10 @@ void setupAdv(void)
|
||||
|
||||
Bluefruit.addAdvApperance(BLE_APPEARANCE_HID_MOUSE);
|
||||
|
||||
// Include ble hid service
|
||||
// Include BLE HID service
|
||||
Bluefruit.addAdvService(blehid);
|
||||
|
||||
// There is enough room for Name in Advertising packet
|
||||
// There is enough room for the name in the advertising packet
|
||||
Bluefruit.addAdvName();
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ void loop()
|
||||
// convert to upper case
|
||||
ch = (char) toupper(ch);
|
||||
|
||||
// ehco
|
||||
// echo
|
||||
Serial.println(ch);
|
||||
|
||||
switch(ch)
|
||||
{
|
||||
// WASD is mouse move
|
||||
// WASD to move the mouse
|
||||
case 'W':
|
||||
blehid.mouseMove(0, -MOVE_STEP);
|
||||
break;
|
||||
@@ -98,7 +98,7 @@ void loop()
|
||||
blehid.mouseMove(MOVE_STEP, 0);
|
||||
break;
|
||||
|
||||
// LRM is mouse button
|
||||
// LRMBF for mouse button(s)
|
||||
case 'L':
|
||||
blehid.mouseButtonPress(MOUSE_BUTTON_LEFT);
|
||||
break;
|
||||
@@ -116,7 +116,7 @@ void loop()
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
// This key is not always supported by OS
|
||||
// This key is not always supported by every OS
|
||||
blehid.mouseButtonPress(MOUSE_BUTTON_FORWARD);
|
||||
break;
|
||||
|
||||
|
||||
Reference in new issue
Block a user