Remove bluefruit_le_read_battery_voltage function (#25129)

This commit is contained in:
Joel Challis 2025-04-19 22:52:25 +01:00 committed by GitHub
parent 7e68cfc6fa
commit ce8b8414d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 11 additions and 58 deletions

View file

@ -32,13 +32,8 @@
# define BLUEFRUIT_LE_SCK_DIVISOR 2 // 4MHz SCK/8MHz CPU, calculated for Feather 32U4 BLE
#endif
#define SAMPLE_BATTERY
#define ConnectionUpdateInterval 1000 /* milliseconds */
#ifndef BATTERY_LEVEL_PIN
# define BATTERY_LEVEL_PIN B5
#endif
static struct {
bool is_connected;
bool initialized;
@ -48,10 +43,6 @@ static struct {
#define UsingEvents 2
bool event_flags;
#ifdef SAMPLE_BATTERY
uint16_t last_battery_update;
uint32_t vbat;
#endif
uint16_t last_connection_update;
} state;
@ -549,14 +540,6 @@ void bluefruit_le_task(void) {
set_connected(atoi(resbuf));
}
}
#ifdef SAMPLE_BATTERY
if (timer_elapsed(state.last_battery_update) > BatteryUpdateInterval && resp_buf.empty()) {
state.last_battery_update = timer_read();
state.vbat = analogReadPin(BATTERY_LEVEL_PIN);
}
#endif
}
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) {
}
}
uint32_t bluefruit_le_read_battery_voltage(void) {
return state.vbat;
}
bool bluefruit_le_set_mode_leds(bool on) {
if (!state.configured) {
return false;

View file

@ -45,10 +45,6 @@ extern void bluefruit_le_send_consumer(uint16_t usage);
* change. */
extern void bluefruit_le_send_mouse(report_mouse_t *report);
/* Compute battery voltage by reading an analog pin.
* Returns the integer number of millivolts */
extern uint32_t bluefruit_le_read_battery_voltage(void);
extern bool bluefruit_le_set_mode_leds(bool on);
extern bool bluefruit_le_set_power_level(int8_t level);