mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-24 02:10:46 +00:00
allow overriding INA3221 channels (#7035)
Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
This commit is contained in:
parent
ac52edd11a
commit
f1dd623ce9
@ -8,16 +8,24 @@
|
|||||||
#include "VoltageSensor.h"
|
#include "VoltageSensor.h"
|
||||||
#include <INA3221.h>
|
#include <INA3221.h>
|
||||||
|
|
||||||
|
#ifndef INA3221_ENV_CH
|
||||||
|
#define INA3221_ENV_CH INA3221_CH1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INA3221_BAT_CH
|
||||||
|
#define INA3221_BAT_CH INA3221_CH1
|
||||||
|
#endif
|
||||||
|
|
||||||
class INA3221Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
|
class INA3221Sensor : public TelemetrySensor, VoltageSensor, CurrentSensor
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
INA3221 ina3221 = INA3221(INA3221_ADDR42_SDA);
|
INA3221 ina3221 = INA3221(INA3221_ADDR42_SDA);
|
||||||
|
|
||||||
// channel to report voltage/current for environment metrics
|
// channel to report voltage/current for environment metrics
|
||||||
ina3221_ch_t ENV_CH = INA3221_CH1;
|
static const ina3221_ch_t ENV_CH = INA3221_ENV_CH;
|
||||||
|
|
||||||
// channel to report battery voltage for device_battery_ina_address
|
// channel to report battery voltage for device_battery_ina_address
|
||||||
ina3221_ch_t BAT_CH = INA3221_CH1;
|
static const ina3221_ch_t BAT_CH = INA3221_BAT_CH;
|
||||||
|
|
||||||
// get a single measurement for a channel
|
// get a single measurement for a channel
|
||||||
struct _INA3221Measurement getMeasurement(ina3221_ch_t ch);
|
struct _INA3221Measurement getMeasurement(ina3221_ch_t ch);
|
||||||
|
@ -219,6 +219,10 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
|
|||||||
|
|
||||||
// Testing USB detection
|
// Testing USB detection
|
||||||
#define NRF_APM
|
#define NRF_APM
|
||||||
|
// If using a power chip like the INA3221 you can override the default battery voltage channel below
|
||||||
|
// and comment out NRF_APM to use the INA3221 instead of the USB detection for charging
|
||||||
|
// #define INA3221_BAT_CH INA3221_CH2
|
||||||
|
// #define INA3221_ENV_CH INA3221_CH1
|
||||||
|
|
||||||
// enables 3.3V periphery like GPS or IO Module
|
// enables 3.3V periphery like GPS or IO Module
|
||||||
// Do not toggle this for GPS power savings
|
// Do not toggle this for GPS power savings
|
||||||
|
Loading…
Reference in New Issue
Block a user