summaryrefslogtreecommitdiff
path: root/keyboards/handwired/promethium
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2020-07-02 13:12:34 +1000
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit8a4a0c25fdb2c4d0ac3ac8fd5f6ba14b56f4cd28 (patch)
treea7bd17453814e37839531484a147fb03773e6215 /keyboards/handwired/promethium
parent60e5733c487cc0435e7d3b913f31ce4acc405d4a (diff)
Change analogRead calls to analogReadPin (#9023)
* Change analogRead calls to analogReadPin * Add ChangeLog * Update docs, remove mention of `analogRead()` * Retarget changelog for next round
Diffstat (limited to 'keyboards/handwired/promethium')
-rw-r--r--keyboards/handwired/promethium/config.h1
-rw-r--r--keyboards/handwired/promethium/promethium.c3
2 files changed, 2 insertions, 2 deletions
diff --git a/keyboards/handwired/promethium/config.h b/keyboards/handwired/promethium/config.h
index f9560206b4..20c5e6a855 100644
--- a/keyboards/handwired/promethium/config.h
+++ b/keyboards/handwired/promethium/config.h
@@ -150,7 +150,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_FUNCTION
#define PS2_MOUSE_INIT_DELAY 2000
-#define BATTERY_PIN 9
#define BATTERY_POLL 30000
#define MAX_VOLTAGE 4.2
#define MIN_VOLTAGE 3.2
diff --git a/keyboards/handwired/promethium/promethium.c b/keyboards/handwired/promethium/promethium.c
index 3cc0f5a8c8..96bcf3ce14 100644
--- a/keyboards/handwired/promethium/promethium.c
+++ b/keyboards/handwired/promethium/promethium.c
@@ -3,6 +3,7 @@
#include "timer.h"
#include "matrix.h"
#include "musical_notes.h"
+#include "adafruit_ble.h"
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A4, 0.0625);
float fauxclicky_released_note[2] = MUSICAL_NOTE(_A4, 0.0625);
@@ -11,7 +12,7 @@ float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 0.25);
// cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100}
uint8_t battery_level(void) {
- float voltage = analogRead(BATTERY_PIN) * 2 * 3.3 / 1024;
+ float voltage = adafruit_ble_read_battery_voltage() * 2 * 3.3 / 1024;
if (voltage < MIN_VOLTAGE) return 0;
if (voltage > MAX_VOLTAGE) return 255;
return (voltage - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE) * 255;