diff options
| author | Joel Challis <git@zvecr.com> | 2025-04-19 22:52:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-19 22:52:25 +0100 |
| commit | ce8b8414d96e9d9ecb2e001fc5844a8fa9b7addc (patch) | |
| tree | ae6216a06adebe37cb44e887ef33a43d02496d67 /drivers/bluetooth | |
| parent | 7e68cfc6fa4adf4b17e06cd5138cc9c2ad40f3e3 (diff) | |
Remove `bluefruit_le_read_battery_voltage` function (#25129)
Diffstat (limited to 'drivers/bluetooth')
| -rw-r--r-- | drivers/bluetooth/bluefruit_le.cpp | 21 | ||||
| -rw-r--r-- | drivers/bluetooth/bluefruit_le.h | 4 |
2 files changed, 0 insertions, 25 deletions
diff --git a/drivers/bluetooth/bluefruit_le.cpp b/drivers/bluetooth/bluefruit_le.cpp index 218eca2195..5fdd104dcf 100644 --- a/drivers/bluetooth/bluefruit_le.cpp +++ b/drivers/bluetooth/bluefruit_le.cpp | |||
| @@ -32,13 +32,8 @@ | |||
| 32 | # define BLUEFRUIT_LE_SCK_DIVISOR 2 // 4MHz SCK/8MHz CPU, calculated for Feather 32U4 BLE | 32 | # define BLUEFRUIT_LE_SCK_DIVISOR 2 // 4MHz SCK/8MHz CPU, calculated for Feather 32U4 BLE |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #define SAMPLE_BATTERY | ||
| 36 | #define ConnectionUpdateInterval 1000 /* milliseconds */ | 35 | #define ConnectionUpdateInterval 1000 /* milliseconds */ |
| 37 | 36 | ||
| 38 | #ifndef BATTERY_LEVEL_PIN | ||
| 39 | # define BATTERY_LEVEL_PIN B5 | ||
| 40 | #endif | ||
| 41 | |||
| 42 | static struct { | 37 | static struct { |
| 43 | bool is_connected; | 38 | bool is_connected; |
| 44 | bool initialized; | 39 | bool initialized; |
| @@ -48,10 +43,6 @@ static struct { | |||
| 48 | #define UsingEvents 2 | 43 | #define UsingEvents 2 |
| 49 | bool event_flags; | 44 | bool event_flags; |
| 50 | 45 | ||
| 51 | #ifdef SAMPLE_BATTERY | ||
| 52 | uint16_t last_battery_update; | ||
| 53 | uint32_t vbat; | ||
| 54 | #endif | ||
| 55 | uint16_t last_connection_update; | 46 | uint16_t last_connection_update; |
| 56 | } state; | 47 | } state; |
| 57 | 48 | ||
| @@ -549,14 +540,6 @@ void bluefruit_le_task(void) { | |||
| 549 | set_connected(atoi(resbuf)); | 540 | set_connected(atoi(resbuf)); |
| 550 | } | 541 | } |
| 551 | } | 542 | } |
| 552 | |||
| 553 | #ifdef SAMPLE_BATTERY | ||
| 554 | if (timer_elapsed(state.last_battery_update) > BatteryUpdateInterval && resp_buf.empty()) { | ||
| 555 | state.last_battery_update = timer_read(); | ||
| 556 | |||
| 557 | state.vbat = analogReadPin(BATTERY_LEVEL_PIN); | ||
| 558 | } | ||
| 559 | #endif | ||
| 560 | } | 543 | } |
| 561 | 544 | ||
| 562 | static bool process_queue_item(struct queue_item *item, uint16_t timeout) { | 545 | static bool process_queue_item(struct queue_item *item, uint16_t timeout) { |
| @@ -655,10 +638,6 @@ void bluefruit_le_send_mouse(report_mouse_t *report) { | |||
| 655 | } | 638 | } |
| 656 | } | 639 | } |
| 657 | 640 | ||
| 658 | uint32_t bluefruit_le_read_battery_voltage(void) { | ||
| 659 | return state.vbat; | ||
| 660 | } | ||
| 661 | |||
| 662 | bool bluefruit_le_set_mode_leds(bool on) { | 641 | bool bluefruit_le_set_mode_leds(bool on) { |
| 663 | if (!state.configured) { | 642 | if (!state.configured) { |
| 664 | return false; | 643 | return false; |
diff --git a/drivers/bluetooth/bluefruit_le.h b/drivers/bluetooth/bluefruit_le.h index a3de03c35c..5efe92b6e0 100644 --- a/drivers/bluetooth/bluefruit_le.h +++ b/drivers/bluetooth/bluefruit_le.h | |||
| @@ -45,10 +45,6 @@ extern void bluefruit_le_send_consumer(uint16_t usage); | |||
| 45 | * change. */ | 45 | * change. */ |
| 46 | extern void bluefruit_le_send_mouse(report_mouse_t *report); | 46 | extern void bluefruit_le_send_mouse(report_mouse_t *report); |
| 47 | 47 | ||
| 48 | /* Compute battery voltage by reading an analog pin. | ||
| 49 | * Returns the integer number of millivolts */ | ||
| 50 | extern uint32_t bluefruit_le_read_battery_voltage(void); | ||
| 51 | |||
| 52 | extern bool bluefruit_le_set_mode_leds(bool on); | 48 | extern bool bluefruit_le_set_mode_leds(bool on); |
| 53 | extern bool bluefruit_le_set_power_level(int8_t level); | 49 | extern bool bluefruit_le_set_power_level(int8_t level); |
| 54 | 50 | ||
