INA260 + INA219 sensor support (#1501)

* INA219 + INA260 support in telemetry

* Protobuf update

* Fixes + debug statement

* Fix size

* Fix conversion from mv

* Added getRegisterValue for i2cscan
This commit is contained in:
Ben Meadors
2022-06-11 16:44:56 -05:00
committed by GitHub
parent 3fd756900a
commit 90957e6994
17 changed files with 182 additions and 58 deletions

View File

@@ -12,26 +12,30 @@
/* Enum definitions */
/* TODO: REPLACE */
typedef enum _TelemetrySensorType {
/* No external telemetry sensor */
/* No external telemetry sensor explicitly set */
TelemetrySensorType_NotSet = 0,
/* TODO: REPLACE */
/* Moderate accuracy temperature */
TelemetrySensorType_DHT11 = 1,
/* TODO: REPLACE */
/* High accuracy temperature */
TelemetrySensorType_DS18B20 = 2,
/* TODO: REPLACE */
/* Moderate accuracy temperature and humidity */
TelemetrySensorType_DHT12 = 3,
/* TODO: REPLACE */
/* Moderate accuracy temperature and humidity */
TelemetrySensorType_DHT21 = 4,
/* TODO: REPLACE */
/* Moderate accuracy temperature and humidity */
TelemetrySensorType_DHT22 = 5,
/* TODO: REPLACE */
/* High accuracy temperature, pressure, humidity */
TelemetrySensorType_BME280 = 6,
/* TODO: REPLACE */
/* High accuracy temperature, pressure, humidity, and air resistance */
TelemetrySensorType_BME680 = 7,
/* TODO: REPLACE */
/* Very high accuracy temperature */
TelemetrySensorType_MCP9808 = 8,
/* TODO: REPLACE */
TelemetrySensorType_SHTC3 = 9
/* Moderate accuracy temperature and humidity */
TelemetrySensorType_SHTC3 = 9,
/* Moderate accuracy current and voltage */
TelemetrySensorType_INA260 = 10,
/* Moderate accuracy current and voltage */
TelemetrySensorType_INA219 = 11
} TelemetrySensorType;
/* Struct definitions */
@@ -65,10 +69,10 @@ typedef struct _EnvironmentMetrics {
/* Types of Measurements the telemetry module is equipped to handle */
typedef struct _Telemetry {
/* This is usually not sent over the mesh (to save space), but it is sent
from the phone so that the local device can set its RTC If it is sent over
the mesh (because there are devices on the mesh without GPS), it will only
be sent by devices which has a hardware GPS clock (IE Mobile Phone).
/* This is usually not sent over the mesh (to save space), but it is sent
from the phone so that the local device can set its RTC If it is sent over
the mesh (because there are devices on the mesh without GPS), it will only
be sent by devices which has a hardware GPS clock (IE Mobile Phone).
seconds since 1970 */
uint32_t time;
/* Key native device metrics such as battery level */
@@ -82,8 +86,8 @@ typedef struct _Telemetry {
/* Helper constants for enums */
#define _TelemetrySensorType_MIN TelemetrySensorType_NotSet
#define _TelemetrySensorType_MAX TelemetrySensorType_SHTC3
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_SHTC3+1))
#define _TelemetrySensorType_MAX TelemetrySensorType_INA219
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_INA219+1))
#ifdef __cplusplus