Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: INA219-HelloWorld INA_219 Light example-ublox-cellular-psm ... more
INA219_consts.h
00001 /* 00002 'Borrowed' from Adafruit's INA219 libarary. Licensed under the BSD license. 00003 00004 https://github.com/adafruit/Adafruit_INA219 00005 */ 00006 00007 // Hopefully Adafruit won't mind if I borrow this... 00008 00009 /*========================================================================= 00010 I2C ADDRESS/BITS 00011 -----------------------------------------------------------------------*/ 00012 #define INA219_ADDRESS (0x40) // 1000000 (A0+A1=GND) 00013 #define INA219_READ (0x01) 00014 /*=========================================================================*/ 00015 00016 /*========================================================================= 00017 CONFIG REGISTER (R/W) 00018 -----------------------------------------------------------------------*/ 00019 #define INA219_REG_CONFIG (0x00) 00020 /*---------------------------------------------------------------------*/ 00021 #define INA219_CONFIG_RESET (0x8000) // Reset Bit 00022 00023 #define INA219_CONFIG_BVOLTAGERANGE_MASK (0x2000) // Bus Voltage Range Mask 00024 #define INA219_CONFIG_BVOLTAGERANGE_16V (0x0000) // 0-16V Range 00025 #define INA219_CONFIG_BVOLTAGERANGE_32V (0x2000) // 0-32V Range 00026 00027 #define INA219_CONFIG_GAIN_MASK (0x1800) // Gain Mask 00028 #define INA219_CONFIG_GAIN_1_40MV (0x0000) // Gain 1, 40mV Range 00029 #define INA219_CONFIG_GAIN_2_80MV (0x0800) // Gain 2, 80mV Range 00030 #define INA219_CONFIG_GAIN_4_160MV (0x1000) // Gain 4, 160mV Range 00031 #define INA219_CONFIG_GAIN_8_320MV (0x1800) // Gain 8, 320mV Range 00032 00033 #define INA219_CONFIG_BADCRES_MASK (0x0780) // Bus ADC Resolution Mask 00034 #define INA219_CONFIG_BADCRES_9BIT (0x0080) // 9-bit bus res = 0..511 00035 #define INA219_CONFIG_BADCRES_10BIT (0x0100) // 10-bit bus res = 0..1023 00036 #define INA219_CONFIG_BADCRES_11BIT (0x0200) // 11-bit bus res = 0..2047 00037 #define INA219_CONFIG_BADCRES_12BIT (0x0400) // 12-bit bus res = 0..4097 00038 00039 #define INA219_CONFIG_SADCRES_MASK (0x0078) // Shunt ADC Resolution and Averaging Mask 00040 #define INA219_CONFIG_SADCRES_9BIT_1S_84US (0x0000) // 1 x 9-bit shunt sample 00041 #define INA219_CONFIG_SADCRES_10BIT_1S_148US (0x0008) // 1 x 10-bit shunt sample 00042 #define INA219_CONFIG_SADCRES_11BIT_1S_276US (0x0010) // 1 x 11-bit shunt sample 00043 #define INA219_CONFIG_SADCRES_12BIT_1S_532US (0x0018) // 1 x 12-bit shunt sample 00044 #define INA219_CONFIG_SADCRES_12BIT_2S_1060US (0x0048) // 2 x 12-bit shunt samples averaged together 00045 #define INA219_CONFIG_SADCRES_12BIT_4S_2130US (0x0050) // 4 x 12-bit shunt samples averaged together 00046 #define INA219_CONFIG_SADCRES_12BIT_8S_4260US (0x0058) // 8 x 12-bit shunt samples averaged together 00047 #define INA219_CONFIG_SADCRES_12BIT_16S_8510US (0x0060) // 16 x 12-bit shunt samples averaged together 00048 #define INA219_CONFIG_SADCRES_12BIT_32S_17MS (0x0068) // 32 x 12-bit shunt samples averaged together 00049 #define INA219_CONFIG_SADCRES_12BIT_64S_34MS (0x0070) // 64 x 12-bit shunt samples averaged together 00050 #define INA219_CONFIG_SADCRES_12BIT_128S_69MS (0x0078) // 128 x 12-bit shunt samples averaged together 00051 00052 #define INA219_CONFIG_MODE_MASK (0x0007) // Operating Mode Mask 00053 #define INA219_CONFIG_MODE_POWERDOWN (0x0000) 00054 #define INA219_CONFIG_MODE_SVOLT_TRIGGERED (0x0001) 00055 #define INA219_CONFIG_MODE_BVOLT_TRIGGERED (0x0002) 00056 #define INA219_CONFIG_MODE_SANDBVOLT_TRIGGERED (0x0003) 00057 #define INA219_CONFIG_MODE_ADCOFF (0x0004) 00058 #define INA219_CONFIG_MODE_SVOLT_CONTINUOUS (0x0005) 00059 #define INA219_CONFIG_MODE_BVOLT_CONTINUOUS (0x0006) 00060 #define INA219_CONFIG_MODE_SANDBVOLT_CONTINUOUS (0x0007) 00061 /*=========================================================================*/ 00062 00063 /*========================================================================= 00064 SHUNT VOLTAGE REGISTER (R) 00065 -----------------------------------------------------------------------*/ 00066 #define INA219_REG_SHUNTVOLTAGE (0x01) 00067 /*=========================================================================*/ 00068 00069 /*========================================================================= 00070 BUS VOLTAGE REGISTER (R) 00071 -----------------------------------------------------------------------*/ 00072 #define INA219_REG_BUSVOLTAGE (0x02) 00073 /*=========================================================================*/ 00074 00075 /*========================================================================= 00076 POWER REGISTER (R) 00077 -----------------------------------------------------------------------*/ 00078 #define INA219_REG_POWER (0x03) 00079 /*=========================================================================*/ 00080 00081 /*========================================================================= 00082 CURRENT REGISTER (R) 00083 -----------------------------------------------------------------------*/ 00084 #define INA219_REG_CURRENT (0x04) 00085 /*=========================================================================*/ 00086 00087 /*========================================================================= 00088 CALIBRATION REGISTER (R/W) 00089 -----------------------------------------------------------------------*/ 00090 #define INA219_REG_CALIBRATION (0x05) 00091 /*=========================================================================*/
Generated on Tue Jul 12 2022 13:24:03 by
1.7.2
INA219 High Side Current Sensor