Skip to content

Commit

Permalink
Improve documentation; Change default device info
Browse files Browse the repository at this point in the history
  • Loading branch information
T-vK committed Aug 8, 2019
1 parent 834621d commit 00ca282
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion BleMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ bool BleMouse::isConnected(void) {

void BleMouse::setBatteryLevel(uint8_t level) {
this->batteryLevel = level;
this->hid->setBatteryLevel(level);
}

void BleMouse::taskServer(void* pvParameter) {
Expand Down
2 changes: 1 addition & 1 deletion BleMouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BleMouse {
void rawAction(uint8_t msg[], char msgSize);
static void taskServer(void* pvParameter);
public:
BleMouse(std::string deviceName = "Espressif", std::string deviceManufacturer = "ESP32 Bluetooth Mouse", uint8_t batteryLevel = 100);
BleMouse(std::string deviceName = "ESP32 Bluetooth Mouse", std::string deviceManufacturer = "Espressif", uint8_t batteryLevel = 100);
void begin(void);
void end(void);
void click(uint8_t b = MOUSE_LEFT);
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This library allows you to make the ESP32 act as a Bluetooth Mouse and control w
- [x] Move mouse pointer up/down
- [x] Scroll up/down
- [x] Scroll left/right
- [ ] Report optional battery level to host
- [x] Customize Bluetooth device name/manufacturer
- [x] Compatible with Android
- [x] Compatible with Windows
- [x] Compatible with Linux
Expand Down Expand Up @@ -59,11 +61,18 @@ Just remember that you have to use `bleMouse` instead of just `Mouse` and you ne
BleMouse bleMouse;
```

This library supports two additional features that the Mouse library does not support at the time of writing:
This library supports a few additional features that the Mouse library does not support at the time of writing:

- Scrolling left/right E.g.: `bleMouse.move(0,0,0,1)` (Scroll left) and `bleMouse.move(0,0,0,-1)` (Scroll right)
- Using the back and forward buttons E.g.: `bleMouse.click(MOUSE_BACK)` and `bleMouse.click(MOUSE_FORWARD)`

There is also Bluetooth specific information that you can use (optional):

Instead of `BleMouse bleMouse;` you can do `BleMouse bleMouse("Bluetooth Device Name", "Bluetooth Device Manufacturer", 100);`.
The third parameter is the initial battery level of your device. To adjust the battery level later on you can simply call e.g. `bleMouse.setBatteryLevel(50)` (set battery level to 50%).
By default the battery level will be set to 100%, the device name will be `ESP32 Bluetooth Mouse` and the manufacturer will be `Espressif`.


## Credits

Credits to [chegewara](https://github.com/chegewara) as this library is based on [this piece of code](https://github.com/nkolban/esp32-snippets/issues/230#issuecomment-473135679) that he provided.

0 comments on commit 00ca282

Please sign in to comment.