5 #ifndef _Adafruit_FeatherOLED_H_ 9 #define _Adafruit_FeatherOLED_H_ 11 #include <Adafruit_GFX.h> 12 #include <Adafruit_SSD1306.h> 15 #if defined(__SAMD51__) 18 #define VBAT_MULTIPLIER 2.0 * 3.3 / 1024.0 20 #elif defined(ARDUINO_ARCH_SAMD) 23 #define VBAT_MULTIPLIER 2.0 * 3.3 / 1024.0 25 #elif defined(__AVR_ATmega32U4__) 28 #define VBAT_MULTIPLIER 2.0 * 3.3 / 1024.0 30 #elif defined(ESP8266) 42 #define RESISTOR_BAT 100000 43 #define RESISTOR_GND 10000 44 #define VBAT_MULTIPLIER ((RESISTOR_BAT + RESISTOR_GND) / RESISTOR_GND) / 1024.0 46 #elif defined(ESP32) && !defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2) 51 #define VBAT_MULTIPLIER 2.0 * 3.3 * 1.1 / 4098.0 53 #elif defined(ARDUINO_STM32_FEATHER) 56 #define VBAT_MULTIPLIER 2.0 * 0.80566F / 1000.0 58 #elif defined(ARDUINO_FEATHER52) || defined(NRF52840_XXAA) 59 #define VBATPIN PIN_VBAT 60 #define VBAT_MV_PER_LSB \ 61 (0.73242188F) // 3.0V ADC range and 12-bit ADC resolution = 3000mV/4096 63 #ifdef NRF52840_XXAA // if this is for nrf52840 64 #define VBAT_DIVIDER (0.5F) // 150K + 150K voltage divider on VBAT 65 #define VBAT_MULTIPLIER (2.0F) // Compensation factor for the VBAT divider 67 #define VBAT_DIVIDER \ 68 (0.71275837F) // 2M + 0.806M voltage divider on VBAT = (2M / (0.806M + 2M)) 69 #define VBAT_MULTIPLIER (1.403F) // Compensation factor for the VBAT divider 72 #define REAL_VBAT_MV_PER_LSB (VBAT_MULTIPLIER * VBAT_MV_PER_LSB) 74 #elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2) 75 #include "Adafruit_LC709203F.h" 78 #warning "Board VBAT pin is not known!" 92 #if defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2) 93 Adafruit_LC709203F *lc = NULL;
116 : Adafruit_SSD1306(128, 32, wire, reset) {
119 _batteryVisible =
true;
153 #define BATTTEXT_STARTX 77 154 #define BATTTEXT_STARTY 0 155 #define BATTICON_STARTX 110 156 #define BATTICON_STARTY 0 157 #define BATTICON_WIDTH 18 158 #define BATTICON_BARWIDTH3 \ 159 ((BATTICON_WIDTH - 6) / 3) Adafruit FeatherOLED H.
Definition: Adafruit_FeatherOLED.h:87
BatteryIconType
Definition: Adafruit_FeatherOLED.h:102
bool _batteryVisible
Definition: Adafruit_FeatherOLED.h:91
void setBatteryVisible(bool enable)
Sets the Battery Value Visibility.
Definition: Adafruit_FeatherOLED.h:136
void renderBattery(void)
Renders the battery icon.
Definition: Adafruit_FeatherOLED.cpp:48
void setBattery(float vbat)
Sets the Battery Value.
Definition: Adafruit_FeatherOLED.h:128
Adafruit_FeatherOLED(TwoWire *wire=&Wire, int reset=-1)
Class Constructor.
Definition: Adafruit_FeatherOLED.h:115
Definition: Adafruit_FeatherOLED.h:105
bool _batteryIcon
Definition: Adafruit_FeatherOLED.h:90
Definition: Adafruit_FeatherOLED.h:103
float getBatteryVoltage()
Query the Feather for the Lipoly battery voltage.
Definition: Adafruit_FeatherOLED.cpp:151
float _battery
Definition: Adafruit_FeatherOLED.h:89
void init(void)
Initialises the display (always call this first!)
Definition: Adafruit_FeatherOLED.cpp:113
void clearMsgArea(bool update=true)
Clears the message area (the middle 128x16 pixels) and sets the cursor to 0, 8.
Definition: Adafruit_FeatherOLED.cpp:137
void setBatteryIcon(bool enable)
Sets the Battery Icon Visibility.
Definition: Adafruit_FeatherOLED.h:144