pamoja for TypeScript - v0.2.0
    Preparing search index...

    Variable ina219Const

    ina219: {
        adc: {
            bits10: number;
            bits11: number;
            bits12: number;
            bits9: number;
            samples128: number;
            samples16: number;
            samples2: number;
            samples32: number;
            samples4: number;
            samples64: number;
            samples8: number;
        };
        baseAddress: number;
        busRange: { v16: number; v32: number };
        configReset: number;
        gain: { div1: number; div2: number; div4: number; div8: number };
        mode: {
            adcOff: number;
            busContinuous: number;
            busTriggered: number;
            powerDown: number;
            shuntAndBusContinuous: number;
            shuntAndBusTriggered: number;
            shuntContinuous: number;
            shuntTriggered: number;
        };
        pin: { ground: number; scl: number; sda: number; supply: number };
        register: {
            busVoltage: number;
            calibration: number;
            configuration: number;
            current: number;
            power: number;
            shuntVoltage: number;
        };
        sim: {
            busMillivolts: number;
            maxMicroamps: number;
            microamps: number;
            shuntMilliohms: number;
            part(address: number): hal.WordPart;
            reporting(
                address: number,
                shuntMilliohms: number,
                maxMicroamps: number,
                busMillivolts: number,
                microamps: number,
            ): hal.WordPart;
        };
        adcConversionMicros(code: number): number;
        address(a1: number, a0: number): number;
        busMillivolts(raw: number): number;
        busRegister(millivolts: number): number;
        calibration(currentLsbMicroamps: number, shuntMilliohms: number): number;
        configBits(config: sensors.Ina219Config): number;
        configFromBits(bits: number): sensors.Ina219Config;
        conversionMicros(config: sensors.Ina219Config): number;
        conversionReady(raw: number): boolean;
        currentMicroamps(raw: number, currentLsbMicroamps: number): number;
        currentRegister(microamps: number, currentLsbMicroamps: number): number;
        gainRangeMillivolts(code: number): number;
        mathOverflow(raw: number): boolean;
        minimumCurrentLsbMicroamps(maxExpectedMicroamps: number): number;
        powerMicrowatts(raw: number, currentLsbMicroamps: number): number;
        powerRegister(microwatts: number, currentLsbMicroamps: number): number;
        shuntMicrovolts(raw: number): number;
        shuntRegister(microvolts: number): number;
    }

    A TI INA219 current, voltage, and power monitor.

    Type Declaration

    • adc: {
          bits10: number;
          bits11: number;
          bits12: number;
          bits9: number;
          samples128: number;
          samples16: number;
          samples2: number;
          samples32: number;
          samples4: number;
          samples64: number;
          samples8: number;
      }

      The converter codes: a resolution, or samples averaged at 12 bits.

      • bits10: number

        10 bits, 148 us.

      • bits11: number

        11 bits, 276 us.

      • bits12: number

        12 bits, 532 us, the reset setting.

      • bits9: number

        9 bits, 84 us.

      • samples128: number

        128 samples averaged, 68.10 ms.

      • samples16: number

        16 samples averaged, 8.51 ms.

      • samples2: number

        2 samples averaged, 1.06 ms.

      • samples32: number

        32 samples averaged, 17.02 ms.

      • samples4: number

        4 samples averaged, 2.13 ms.

      • samples64: number

        64 samples averaged, 34.05 ms.

      • samples8: number

        8 samples averaged, 4.26 ms.

    • baseAddress: number

      The address with A1 and A0 tied to ground; the pins add to it.

    • busRange: { v16: number; v32: number }

      The bus-voltage range codes.

      • v16: number

        0 to 16 V.

      • v32: number

        0 to 32 V, the reset setting.

    • configReset: number

      The configuration register's power-on value.

    • gain: { div1: number; div2: number; div4: number; div8: number }

      The shunt gain codes, by the shunt-voltage range each gives.

      • div1: number

        Gain 1, 40 mV either side of zero.

      • div2: number

        Gain 1/2, 80 mV.

      • div4: number

        Gain 1/4, 160 mV.

      • div8: number

        Gain 1/8, 320 mV, the reset setting.

    • mode: {
          adcOff: number;
          busContinuous: number;
          busTriggered: number;
          powerDown: number;
          shuntAndBusContinuous: number;
          shuntAndBusTriggered: number;
          shuntContinuous: number;
          shuntTriggered: number;
      }

      The operating-mode codes.

      • adcOff: number

        The converter disabled.

      • busContinuous: number

        Bus conversions back to back.

      • busTriggered: number

        One bus conversion.

      • powerDown: number

        No conversions, lowest power.

      • shuntAndBusContinuous: number

        Shunt and bus conversions back to back, the reset setting.

      • shuntAndBusTriggered: number

        One shunt and one bus conversion.

      • shuntContinuous: number

        Shunt conversions back to back.

      • shuntTriggered: number

        One shunt conversion.

    • pin: { ground: number; scl: number; sda: number; supply: number }

      What an address pin is tied to, as the code the address helper takes.

      • ground: number

        Tied to GND.

      • scl: number

        Tied to SCL.

      • sda: number

        Tied to SDA.

      • supply: number

        Tied to VS+.

    • register: {
          busVoltage: number;
          calibration: number;
          configuration: number;
          current: number;
          power: number;
          shuntVoltage: number;
      }

      The registers a driver reads and writes.

      • busVoltage: number

        The bus voltage in bits 15:3, 4 mV per count, with two flags below.

      • calibration: number

        The calibration, which sets the current and power scale.

      • configuration: number

        Range, gain, converter settings, and mode.

      • current: number

        The current, scaled by the calibration.

      • power: number

        The power, scaled by the calibration.

      • shuntVoltage: number

        The shunt voltage, 10 uV per count.

    • sim: {
          busMillivolts: number;
          maxMicroamps: number;
          microamps: number;
          shuntMilliohms: number;
          part(address: number): hal.WordPart;
          reporting(
              address: number,
              shuntMilliohms: number,
              maxMicroamps: number,
              busMillivolts: number,
              microamps: number,
          ): hal.WordPart;
      }

      An INA219 that is not there, for a bus with nothing plugged in. A monitor's current and power registers count in steps the calibration sets, so reporting takes the same shunt and largest current a driver is given.

      • busMillivolts: number

        The bus voltage part reports, in millivolts.

      • maxMicroamps: number

        The largest current part is sized for, in microamps.

      • microamps: number

        The current part reports, in microamps.

      • shuntMilliohms: number

        The shunt part sits across, in milliohms: the common breakout's.

      • part: function
        • A part carrying 500 mA at 12 V through the shunt a driver starts with.

          Parameters

          • address: number

            The address it answers to.

          Returns hal.WordPart

          The part, to put on a simulated bus.

      • reporting: function
        • A part that reads what it is asked to, on the steps its registers count in: 4 mV of bus, 10 uV of shunt, and the calibration's current step.

          Parameters

          • address: number

            The address it answers to.

          • shuntMilliohms: number

            The shunt, as the driver is given it.

          • maxMicroamps: number

            The largest current, as the driver is given it.

          • busMillivolts: number

            The bus voltage it reports.

          • microamps: number

            The current it reports; negative flows the other way.

          Returns hal.WordPart

          The part, to put on a simulated bus.

    • adcConversionMicros: function
      • Returns how long one conversion takes at a converter code.

        Parameters

        Returns number

        The time in microseconds, from the datasheet's table.

    • address: function
      • Returns the 7-bit address the A1 and A0 pins select, from Table 1 of the datasheet.

        Parameters

        • a1: number

          What the A1 pin is tied to, one of ina219.pin.

        • a0: number

          What the A0 pin is tied to.

        Returns number

        The address, 0x40 to 0x4F.

        If either pin code is not 0, 1, 2, or 3.

    • busMillivolts: function
      • Converts a raw bus-voltage register to millivolts.

        Parameters

        • raw: number

          The register value.

        Returns number

        The bus voltage.

    • busRegister: function
      • Builds the bus-voltage register a monitor reports for a bus voltage.

        Parameters

        • millivolts: number

          The bus voltage in millivolts.

        Returns number

        The register value, with the conversion-ready flag set.

    • calibration: function
      • Computes the calibration register for a shunt and current resolution.

        Parameters

        • currentLsbMicroamps: number

          The microamps per count the current register should carry.

        • shuntMilliohms: number

          The shunt resistor value.

        Returns number

        The register value to write.

    • configBits: function
      • Assembles the configuration register value.

        Parameters

        Returns number

        The register value to write.

    • configFromBits: function
      • Parses a configuration register value.

        Parameters

        • bits: number

          The register value, as read from the part.

        Returns sensors.Ina219Config

        The settings. Every value decodes.

    • conversionMicros: function
      • Returns how long one conversion cycle takes: the shunt and bus conversions the mode runs, one after the other.

        Parameters

        Returns number

        The time in microseconds.

    • conversionReady: function
      • Reports whether a bus-voltage register says a conversion is ready.

        Parameters

        • raw: number

          The register value.

        Returns boolean

        Whether the conversion-ready flag is set.

    • currentMicroamps: function
      • Converts a raw current register to microamps.

        Parameters

        • raw: number

          The signed register value.

        • currentLsbMicroamps: number

          The resolution the calibration selected.

        Returns number

        The current.

    • currentRegister: function
      • Builds the current register a monitor reports for a current.

        Parameters

        • microamps: number

          The current in microamps.

        • currentLsbMicroamps: number

          The current LSB the calibration was set for.

        Returns number

        The signed register value.

    • gainRangeMillivolts: function
      • Returns the shunt-voltage range a gain code selects.

        Parameters

        Returns number

        The range in millivolts either side of zero.

    • mathOverflow: function
      • Reports whether a bus-voltage register flags a math overflow.

        Parameters

        • raw: number

          The register value.

        Returns boolean

        Whether the current and power readings are meaningless, which means the calibration needs revisiting.

    • minimumCurrentLsbMicroamps: function
      • Returns the smallest current resolution that still covers a maximum.

        Parameters

        • maxExpectedMicroamps: number

          The largest current the application measures.

        Returns number

        The minimum current LSB in microamps.

    • powerMicrowatts: function
      • Converts a raw power register to microwatts.

        Parameters

        • raw: number

          The register value.

        • currentLsbMicroamps: number

          The resolution the calibration selected.

        Returns number

        The power. The power LSB is fixed at twenty times the current LSB.

    • powerRegister: function
      • Builds the power register a monitor reports for a power.

        Parameters

        • microwatts: number

          The power in microwatts.

        • currentLsbMicroamps: number

          The current LSB the calibration was set for.

        Returns number

        The register value.

    • shuntMicrovolts: function
      • Parameters

        • raw: number

        Returns number

    • shuntRegister: function
      • Builds the shunt-voltage register a monitor reports for a shunt voltage.

        The inverse of shuntMicrovolts, so a node can be written and tested against what a monitor sends without one attached.

        Parameters

        • microvolts: number

          The shunt voltage in microvolts.

        Returns number

        The signed register value, at 10 uV per count.