2024-07-10 00:56:57 +08:00
|
|
|
/*
|
|
|
|
|
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
|
|
|
|
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
|
|
|
|
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
|
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
See the GNU Lesser General Public License for more details.
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _VARIANT_HELTEC_NRF_
|
|
|
|
|
#define _VARIANT_HELTEC_NRF_
|
|
|
|
|
/** Master clock frequency */
|
|
|
|
|
#define VARIANT_MCK (64000000ul)
|
|
|
|
|
|
2025-12-09 08:02:04 -06:00
|
|
|
#define USE_LFXO // Board uses 32khz crystal for LF
|
|
|
|
|
|
2024-07-10 00:56:57 +08:00
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
|
* Headers
|
|
|
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "WVariant.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
|
|
|
|
|
#define HELTEC_MESH_NODE_T114
|
|
|
|
|
|
|
|
|
|
#define USE_ST7789
|
|
|
|
|
|
|
|
|
|
#define ST7789_NSS 11
|
|
|
|
|
#define ST7789_RS 12 // DC
|
|
|
|
|
#define ST7789_SDA 41 // MOSI
|
|
|
|
|
#define ST7789_SCK 40
|
|
|
|
|
#define ST7789_RESET 2
|
|
|
|
|
#define ST7789_MISO -1
|
|
|
|
|
#define ST7789_BUSY -1
|
|
|
|
|
#define VTFT_CTRL 3
|
|
|
|
|
#define VTFT_LEDA 15
|
|
|
|
|
// #define ST7789_BL (32+6)
|
|
|
|
|
#define TFT_BACKLIGHT_ON LOW
|
|
|
|
|
#define ST7789_SPI_HOST SPI1_HOST
|
2024-08-22 10:40:12 -07:00
|
|
|
// #define TFT_BL (32+6)
|
2024-07-10 00:56:57 +08:00
|
|
|
#define SPI_FREQUENCY 40000000
|
|
|
|
|
#define SPI_READ_FREQUENCY 16000000
|
|
|
|
|
#define TFT_HEIGHT 135
|
2024-07-09 12:16:56 -05:00
|
|
|
#define TFT_WIDTH 240
|
2024-07-10 00:56:57 +08:00
|
|
|
#define TFT_OFFSET_X 0
|
|
|
|
|
#define TFT_OFFSET_Y 0
|
Unify the native display config between legacy display and MUI (#6838)
* Add missed include
* Another Warning fix
* Add another HAS_SCREEN
* Namespace fixes
* Removed depricated destination types and re-factored destination screen
* Get rid of Arduino Strings
* Clean up after Copilot
* SixthLine Def, Screen Rename
Added Sixth Line Definition Screen Rename, and Automatic Line Adjustment
* Consistency is hard - fixed "Sixth"
* System Frame Updates
Adjusted line construction to ensure we fit maximum content per screen.
* Fix up notifications
* Add a couple more ifdef HAS_SCREEN lines
* Add screen->isOverlayBannerShowing()
* Don't forget the invert!
* Adjust Nodelist Center Divider
Adjust Nodelist Center Divider
* Fix variable casting
* Fix entryText variable as empty before update to fix validation
* Altitude is int32_t
* Update PowerTelemetry to have correct data type
* Fix cppcheck warnings (#6945)
* Fix cppcheck warnings
* Adjust logic in Power.cpp for power sensor
---------
Co-authored-by: Jason P <applewiz@mac.com>
* More pixel wrangling so things line up NodeList edition
* Adjust NodeList alignments and plumb some background padding for a possible title fix
* Better alignment for banner notifications
* Move title into drawCommonHeader; initial screen tested
* Fonts make spacing items difficult
* Improved beeping booping and other buzzer based feedback (#6947)
* Improved beeping booping and other buzzer based feedback
* audible button feedback (#6949)
* Refactor
---------
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
* Sandpapered the corners of the notification popup
* Finalize drawCommonHeader migration
* Update Title of Favorite Node Screens
* Update node metric alignment on LoRa screen
* Update the border for popups to separate it from background
* Update PaxcounterModule.cpp with CommonHeader
* Update WiFi screen with CommonHeader and related data reflow
* It was not, in fact, pointing up
* Fix build on wismeshtap
* T-deck trackball debounce
* Fix uptime on Device Focused page to actually detail
* Update Sys screen for new uptime, add label to Freq/Chan on LoRa
* Don't display DOP any longer, make Uptime consistent
* Revert Uptime change on Favorites, Apply to Device Focused
* Label the satelite number to avoid confusion
* Boop boop boop boop
* Correct GPS positioning and string consistency across strings for GPS
* Fix GPS text alignment
* Enable canned messages by default
* Don't wake screen on new nodes
* Cannedmessage list emote support added
* Fn+e emote picker for freetext screen
* Actually block CannedInput actions while display is shown
* Add selection menu to bannerOverlay
* Off by one
* Move to unified text layouts and spacing
* Still my Fav without an "e"
* Fully remove EVENT_NODEDB_UPDATED
* Simply LoRa screen
* Make some char pointers const to fix compilation on native targets
* Update drawCompassNorth to include radius
* Fix warning
* button thread cleanup
* Pull OneButton handling from PowerFSM and add MUI switch (#6973)
* Trunk
* Onebutton Menu Support
* Add temporary clock icon
* Add gps location to fsi
* Banner message state reset
* Cast to char to satisfy compiler
* Better fast handling of input during banner
* Fix warning
* Derp
* oops
* Update ref
* Wire buzzer_mode
* remove legacy string->print()
* Only init screen if one found
* Unsigned Char
* More buttonThread cleaning
* screen.cpp button handling cleanup
* The Great Event Rename of 2025
* Fix the Radiomaster
* Missed trackball type change
* Remove unused function
* Make ButtonThread an InputBroker
* Coffee hadn't kicked in yet
* Add clock icon for Navigation Bar
* Restore clock screen definition code - whoops
* ExternalNotifications now observe inputBroker
* Clock rework (#6992)
* Move Clock bits into ClockRenderer space
* Rework clock into all device navigation
* T-Watch Actually Builds Different
* Compile fix
---------
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
* Add AM/PM to Digital Clock
* Flip Seconds and AM/PM on Clock Display
* Tik-tok pixels are hard
* Fix builds on Thinknode M1
* Check for GPS and don't crash
* Don't endif til the end
* Rework the OneButton thread to be much less of a mess. (#6997)
* Rework the OneButton thread to be much less of a mess. And break lots of targets temporarily
* Update src/input/ButtonThread.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix GPS toggle
* Send the shutdown event, not just the kbchar
* Honor the back button in a notificaiton popup
* Draw the right size box for popup with options
* Try to un-break all the things
---------
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 24-hour Clock Should have leading zero, but not 12-hour
* Fixup some compile errors
* Add intRoutine to ButtonThread init, to get more responsive user button back
* Add Timezone picker
* Fix Warning
* Optionally set the initial selection for the chooser popup
* Make back buttons work in canned messages
* Drop the wrapper classes
* LonPressTime now configurable
* Clock Frame can not longer be blank; just add valid time
* Back buttons everywhere!
* Key Verification confirm banner
* Make Elecrow M* top button a back button
* Add settings saves
* EInk responsiveness fixes
* Linux Input Fixes
* Add Native Trackball/Joystick support, and move UserButton to Input
* No Flight Stick Mode
* Send input event
* Add Channel Utilization to Device Focused frame
* Don't shift screens when we draw new ones
* Add showOverlayBanner arguments to no-op
* trunk
* Default Native trackball to NC
* Fix crash in simulator mode
* Add longLong button press
* Get the args right
* Adjust Bluetooth Pairing Screen to account for bottom navigation.
* Trackball everywhere, and unPhone buttons
* Remap visionmaster secondary button to TB_UP
* Kill ScanAndSelect
* trunk
* No longer need the canned messages input filter
* All Canned All the time
* Fix stm32 compile error regarding inputBroker
* Unify tft lineheights (#7033)
* Create variable line heights based upon SCREEN_HEIGHT
* Refactor textPositions into method -> getTextPositions
* Update SharedUIDisplay.h
---------
Co-authored-by: Jason P <applewiz@mac.com>
* Adjust top distance for larger displays
* Adjust icon sizes for larger displays
* Fix Paxcounter compile errors after code updates
* Pixel wrangling to make larger screens fit better
* Alert frame has precedence over banner -- for now
* Unify on ALT_BUTTON
* Align AM/PM to the digit, not the segment on larger displays
* Move some global pin defines into configuration.h
* Scaffolding for BMM150 9-axis gyro
* Alt button behavior
* Don't add the blank GPS frames without HAS_GPS
* EVENT_NODEDB_UPDATED has been retired
* Clean out LOG_WARN messages from debugging
* Add dismiss message function
* Minor buttonThread cleanup
* Add BMM150 support
* Clean up last warning from dev
* Simplify bmm150 init return logic
* Add option to reply to messages
* Add minimal menu upon selecting home screen
* Move Messages to slot 2, rename GPS to Position, move variables nearer functional usage in Screen.cpp
* Properly dismiss message
* T-Deck Trackball press is not user button
* Add select on favorite frame to launch cannedMessage DM
* Minor wording change
* Less capital letters
* Fix empty message check, time isn't reliable
* drop dead code
* Make UIRenderer a static class instead of namespace
* Fix the select on favorite
* Check if message is empty early and then 'return'
* Add kb_found, and show the option to launch freetype if appropriate
* Ignore impossible touchscreen touches
* Auto scroll fix
* Move linebreak after "from" for banners to maximize screen usage.
* Center "No messages to show" on Message frame
* Start consolidating buzzer behavior
* Fixed signed / unsigned warning
* Cast second parameter of max() to make some targets happy
* Cast kbchar to (char) to make arduino string happy
* Shorten the notice of "No messages"
* Add buzzer mode chooser
* Add regionPicker to Lora icon
* Reduce line spacing and reorder Position screen to resolve overlapping issues
* Update message titles, fix GPS icons, add Back options
* Leftover boops
* Remove chirp
* Make the region selection dismissable when a region is already set
* Add read-aloud functionality on messages w/ esp8266sam
* "Last Heard" is a better label
* tweak the beep
* 5 options
* properly tear down freetext upon cancel
* de-convelute canned messages just a bit
* Correct height of Mail icon in navigation bar
* Remove unused warning
* Consolidate time methods into TimeFormatters
* Oops
* Change LoRa Picker Cancel to Back
* Tweak selection characters on Banner
* Message render not scrolling on 5th line
* More fixes for message scrolling
* Remove the safety next on text overflow - we found that root cause
* Add pin definitions to fix compilation for obscure target
* Don't let the touchscreen send unitialized kbchar values
* Make virtual KB just a bit quicker
* No more double tap, swipe!
* Left is left, and Right is right
* Update horizontal lightning bolt design
* Move from solid to dashed separator for Message Frame
* Single emote feature fix
* Manually sort overlapping elements for now
* Freetext and clearer choices
* Fix ESP32 InkHUD builds on the unify-tft branch (#7087)
* Remove BaseUI branding
* Capitalization is fun
* Revert Meshtastic Boot Frame Changes
* Add ANZ_433 LoRa region to picker
* Update settings.json
---------
Co-authored-by: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Jason P <applewiz@mac.com>
Co-authored-by: todd-herbert <herbert.todd@gmail.com>
Co-authored-by: Thomas Göttgens <tgoettgens@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-21 06:36:04 -05:00
|
|
|
|
2025-07-02 20:50:49 -05:00
|
|
|
// T114 gets a muted yellow on black display
|
|
|
|
|
#define TFT_MESH_OVERRIDE COLOR565(255, 255, 128)
|
|
|
|
|
|
2024-07-10 00:56:57 +08:00
|
|
|
// #define TFT_OFFSET_ROTATION 0
|
|
|
|
|
// #define SCREEN_ROTATE
|
|
|
|
|
// #define SCREEN_TRANSITION_FRAMERATE 5
|
|
|
|
|
|
|
|
|
|
// Number of pins defined in PinDescription array
|
|
|
|
|
#define PINS_COUNT (48)
|
|
|
|
|
#define NUM_DIGITAL_PINS (48)
|
|
|
|
|
#define NUM_ANALOG_INPUTS (1)
|
|
|
|
|
#define NUM_ANALOG_OUTPUTS (0)
|
|
|
|
|
|
|
|
|
|
// LEDs
|
2024-09-16 17:11:55 -07:00
|
|
|
#define PIN_LED1 (32 + 3) // green (confirmed on 1.0 board)
|
|
|
|
|
#define LED_BLUE PIN_LED1 // fake for bluefruit library
|
|
|
|
|
#define LED_GREEN PIN_LED1
|
|
|
|
|
#define LED_BUILTIN LED_GREEN
|
2024-07-10 00:56:57 +08:00
|
|
|
#define LED_STATE_ON 0 // State when LED is lit
|
|
|
|
|
|
2024-09-16 17:11:55 -07:00
|
|
|
#define HAS_NEOPIXEL // Enable the use of neopixels
|
|
|
|
|
#define NEOPIXEL_COUNT 2 // How many neopixels are connected
|
|
|
|
|
#define NEOPIXEL_DATA 14 // gpio pin used to send data to the neopixels
|
|
|
|
|
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // type of neopixels in use
|
|
|
|
|
|
2024-07-10 00:56:57 +08:00
|
|
|
/*
|
|
|
|
|
* Buttons
|
|
|
|
|
*/
|
|
|
|
|
#define PIN_BUTTON1 (32 + 10)
|
2024-07-09 12:16:56 -05:00
|
|
|
// #define PIN_BUTTON2 (0 + 18) // 0.18 is labeled on the board as RESET but we configure it in the bootloader as a regular
|
|
|
|
|
// GPIO
|
2024-07-10 00:56:57 +08:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
No longer populated on PCB
|
|
|
|
|
*/
|
|
|
|
|
#define PIN_SERIAL2_RX (0 + 9)
|
|
|
|
|
#define PIN_SERIAL2_TX (0 + 10)
|
|
|
|
|
// #define PIN_SERIAL2_EN (0 + 17)
|
|
|
|
|
|
2024-09-17 22:17:53 +12:00
|
|
|
/*
|
|
|
|
|
* I2C
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define WIRE_INTERFACES_COUNT 2
|
|
|
|
|
|
|
|
|
|
// I2C bus 0
|
|
|
|
|
// Routed to footprint for PCF8563TS RTC
|
|
|
|
|
// Not populated on T114 V1, maybe in future?
|
|
|
|
|
#define PIN_WIRE_SDA (0 + 26) // P0.26
|
|
|
|
|
#define PIN_WIRE_SCL (0 + 27) // P0.27
|
2024-07-10 00:56:57 +08:00
|
|
|
|
2024-09-17 22:17:53 +12:00
|
|
|
// I2C bus 1
|
|
|
|
|
// Available on header pins, for general use
|
2024-09-19 02:49:24 +12:00
|
|
|
#define PIN_WIRE1_SDA (0 + 16) // P0.16
|
|
|
|
|
#define PIN_WIRE1_SCL (0 + 13) // P0.13
|
2024-07-10 00:56:57 +08:00
|
|
|
|
|
|
|
|
// QSPI Pins
|
|
|
|
|
#define PIN_QSPI_SCK (32 + 14)
|
|
|
|
|
#define PIN_QSPI_CS (32 + 15)
|
|
|
|
|
#define PIN_QSPI_IO0 (32 + 12) // MOSI if using two bit interface
|
|
|
|
|
#define PIN_QSPI_IO1 (32 + 13) // MISO if using two bit interface
|
|
|
|
|
#define PIN_QSPI_IO2 (0 + 7) // WP if using two bit interface (i.e. not used)
|
|
|
|
|
#define PIN_QSPI_IO3 (0 + 5) // HOLD if using two bit interface (i.e. not used)
|
|
|
|
|
|
|
|
|
|
// On-board QSPI Flash
|
|
|
|
|
#define EXTERNAL_FLASH_DEVICES MX25R1635F
|
|
|
|
|
#define EXTERNAL_FLASH_USE_QSPI
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Lora radio
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define USE_SX1262
|
|
|
|
|
// #define USE_SX1268
|
|
|
|
|
#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead
|
2024-07-09 12:16:56 -05:00
|
|
|
#define LORA_CS (0 + 24)
|
2024-07-10 00:56:57 +08:00
|
|
|
#define SX126X_DIO1 (0 + 20)
|
|
|
|
|
// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
|
2024-08-01 19:29:49 -05:00
|
|
|
// #define SX1262_DIO3 (0 + 21)
|
|
|
|
|
// This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the
|
2024-07-09 12:16:56 -05:00
|
|
|
// main
|
|
|
|
|
// CPU?
|
2024-07-10 00:56:57 +08:00
|
|
|
#define SX126X_BUSY (0 + 17)
|
|
|
|
|
#define SX126X_RESET (0 + 25)
|
|
|
|
|
// Not really an E22 but TTGO seems to be trying to clone that
|
|
|
|
|
#define SX126X_DIO2_AS_RF_SWITCH
|
|
|
|
|
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
|
|
|
|
|
2024-07-09 12:16:56 -05:00
|
|
|
#define PIN_SPI1_MISO \
|
|
|
|
|
ST7789_MISO // FIXME not really needed, but for now the SPI code requires something to be defined, pick an used GPIO
|
|
|
|
|
#define PIN_SPI1_MOSI ST7789_SDA
|
|
|
|
|
#define PIN_SPI1_SCK ST7789_SCK
|
2024-07-10 00:56:57 +08:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* GPS pins
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define GPS_L76K
|
|
|
|
|
|
2024-08-13 06:52:03 -05:00
|
|
|
// #define PIN_GPS_RESET (32 + 6) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K
|
2024-07-10 00:56:57 +08:00
|
|
|
#define GPS_RESET_MODE LOW
|
Enabling Ve pin on T114 (#4940)
* Enabling Ve pin on T114
Problem:
The Ve pin was not enabled in the firmware, and it was supposed to control the power to the GPS via the GPS_EN pin. As a result, users were forced to rely on the 3.3V pin to power their additional peripherals, which caused a constant power draw from the battery, even when the node was in deep sleep mode.
Solution:
To resolve this, Todd_Hervert and I decided to remove the GPS power toggle after testing revealed that the GPS only consumes 1mA in soft sleep mode. This minimal power consumption allowed us to enable the Ve pin without causing significant battery drain. Additionally, we added a delay to the I2C initialization process, as the Ve pin requires a few milliseconds to stabilize, which could prevent some peripherals from booting up in time.
Result:
The GPS operates as usual, drawing only 1mA of power.
The keyboard and other peripherals attached to the Ve pin now power off correctly when the node is shut down.
The I2C check initiates without issues after the delay, allowing all peripherals to function smoothly.
* trunk format
---------
Co-authored-by: Tom Fifield <tom@tomfifield.net>
2024-10-04 07:15:59 -04:00
|
|
|
// #define PIN_GPS_EN (21)
|
|
|
|
|
#define VEXT_ENABLE (0 + 21)
|
|
|
|
|
#define PERIPHERAL_WARMUP_MS 1000 // Make sure I2C QuickLink has stable power before continuing
|
|
|
|
|
#define VEXT_ON_VALUE HIGH
|
|
|
|
|
// #define GPS_EN_ACTIVE HIGH
|
2024-07-10 00:56:57 +08:00
|
|
|
#define PIN_GPS_STANDBY (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake
|
2024-07-09 12:16:56 -05:00
|
|
|
#define PIN_GPS_PPS (32 + 4)
|
2024-07-10 00:56:57 +08:00
|
|
|
// Seems to be missing on this new board
|
|
|
|
|
// #define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS
|
2025-11-25 13:55:28 -06:00
|
|
|
#define GPS_TX_PIN (32 + 7) // This is for bits going TOWARDS the CPU
|
|
|
|
|
#define GPS_RX_PIN (32 + 5) // This is for bits going TOWARDS the GPS
|
2024-07-10 00:56:57 +08:00
|
|
|
|
|
|
|
|
#define GPS_THREAD_INTERVAL 50
|
|
|
|
|
|
2025-11-27 01:10:21 +08:00
|
|
|
#define PIN_SERIAL1_RX GPS_RX_PIN
|
|
|
|
|
#define PIN_SERIAL1_TX GPS_TX_PIN
|
2024-07-10 00:56:57 +08:00
|
|
|
|
|
|
|
|
// PCF8563 RTC Module
|
|
|
|
|
#define PCF8563_RTC 0x51
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* SPI Interfaces
|
|
|
|
|
*/
|
|
|
|
|
#define SPI_INTERFACES_COUNT 2
|
|
|
|
|
|
|
|
|
|
// For LORA, spi 0
|
|
|
|
|
#define PIN_SPI_MISO (0 + 23)
|
|
|
|
|
#define PIN_SPI_MOSI (0 + 22)
|
|
|
|
|
#define PIN_SPI_SCK (0 + 19)
|
|
|
|
|
|
2024-07-09 12:16:56 -05:00
|
|
|
// #define PIN_PWR_EN (0 + 6)
|
2024-07-10 00:56:57 +08:00
|
|
|
|
|
|
|
|
// To debug via the segger JLINK console rather than the CDC-ACM serial device
|
|
|
|
|
// #define USE_SEGGER
|
|
|
|
|
|
|
|
|
|
// Battery
|
|
|
|
|
// The battery sense is hooked to pin A0 (4)
|
|
|
|
|
// it is defined in the anlaolgue pin section of this file
|
|
|
|
|
// and has 12 bit resolution
|
|
|
|
|
|
|
|
|
|
#define ADC_CTRL 6
|
|
|
|
|
#define ADC_CTRL_ENABLED HIGH
|
|
|
|
|
#define BATTERY_PIN 4
|
|
|
|
|
#define ADC_RESOLUTION 14
|
|
|
|
|
|
|
|
|
|
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
|
|
|
|
#define BATTERY_SENSE_RESOLUTION 4096.0
|
|
|
|
|
#undef AREF_VOLTAGE
|
|
|
|
|
#define AREF_VOLTAGE 3.0
|
|
|
|
|
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
2025-09-06 05:14:26 -04:00
|
|
|
#define ADC_MULTIPLIER (4.916F)
|
2024-07-10 00:56:57 +08:00
|
|
|
|
2025-11-18 18:23:39 +01:00
|
|
|
// rf52840 AIN2 = Pin 4
|
2025-12-02 01:21:49 +00:00
|
|
|
// commented out due to power leakage of 2.9mA in shutdown state see reported issue #8801
|
|
|
|
|
// #define BATTERY_LPCOMP_INPUT NRF_LPCOMP_INPUT_2 //UNSAFE
|
2025-11-18 18:23:39 +01:00
|
|
|
|
|
|
|
|
// We have AIN2 with a VBAT divider so AIN2 = VBAT * (100/490)
|
|
|
|
|
// We have the device going deep sleep under 3.1V, which is AIN2 = 0.63V
|
|
|
|
|
// So we can wake up when VBAT>=VDD is restored to 3.3V, where AIN2 = 0.67V
|
|
|
|
|
// Ratio 0.67/3.3 = 0.20, so we can pick a bit higher, 2/8 VDD, which means
|
|
|
|
|
// VBAT=4.04V
|
|
|
|
|
#define BATTERY_LPCOMP_THRESHOLD NRF_LPCOMP_REF_SUPPLY_2_8
|
|
|
|
|
|
2024-07-10 00:56:57 +08:00
|
|
|
#define HAS_RTC 0
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------
|
|
|
|
|
* Arduino objects - C++ only
|
|
|
|
|
*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2024-09-16 17:11:55 -07:00
|
|
|
#endif
|