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

    Variable ds18b20Const

    ds18b20: {
        familyCode: number;
        buildScratchpad(
            celsius: number,
            resolutionBits: number,
            alarmHigh: number,
            alarmLow: number,
        ): Buffer;
        celsius(raw: number): number;
        configByte(bits: number): number;
        crc8(data: Uint8Array): number;
        maxConversionMicros(bits: number): number;
        microCelsius(raw: number): number;
        parseScratchpad(bytes: Uint8Array): Ds18b20Reading;
        resolutionBits(configByte: number): number;
        stepMicroCelsius(bits: number): number;
    } = ...

    A Maxim DS18B20 1-Wire thermometer.

    Type Declaration

    • familyCode: number

      The 1-Wire family code that identifies a DS18B20 on the bus.

    • buildScratchpad: function
      • Builds the nine bytes a part in the given state puts on the bus.

        This is the inverse of parseScratchpad, so a node can be written and tested against what a thermometer sends without one attached.

        Parameters

        • celsius: number

          The temperature the part is reading.

        • resolutionBits: number

          The resolution it is configured for, 9 to 12.

        • alarmHigh: number

          The high alarm threshold in whole degrees Celsius.

        • alarmLow: number

          The low alarm threshold in whole degrees Celsius.

        Returns Buffer

        The nine scratchpad bytes in transmission order, CRC last.

        If the resolution is not 9, 10, 11, or 12 bits.

    • celsius: function
      • Converts a raw temperature register to degrees Celsius.

        Parameters

        • raw: number

          The 16-bit two's-complement register.

        Returns number

        The temperature.

    • configByte: function
      • Returns the configuration byte that selects a resolution.

        Parameters

        • bits: number

          The resolution in bits: 9, 10, 11, or 12.

        Returns number

        The byte to write to the configuration register.

        If the resolution is not one the part offers.

    • crc8: function
      • Computes the Maxim CRC-8 a 1-Wire device checks its own bytes with.

        Parameters

        • data: Uint8Array

          The bytes the checksum covers.

        Returns number

        The checksum.

    • maxConversionMicros: function
      • Returns how long a conversion may take at a resolution.

        Parameters

        • bits: number

          The resolution in bits.

        Returns number

        The datasheet's worst case, in microseconds.

        If the resolution is not one the part offers.

    • microCelsius: function
      • Converts a raw temperature register to micro-degrees Celsius.

        Parameters

        • raw: number

          The 16-bit two's-complement register.

        Returns number

        The temperature, exact in integer arithmetic.

    • parseScratchpad: function
      • Parses and CRC-checks a nine-byte scratchpad.

        Parameters

        • bytes: Uint8Array

          The scratchpad as the device sent it, the ninth byte its CRC.

        Returns Ds18b20Reading

        The decoded reading.

        If the CRC does not match, which means the read was corrupted on the bus and should be repeated.

    • resolutionBits: function
      • Returns the resolution a configuration byte selects.

        Parameters

        • configByte: number

          The byte read from the configuration register.

        Returns number

        The resolution in bits.

    • stepMicroCelsius: function
      • Returns the temperature step a resolution resolves.

        Parameters

        • bits: number

          The resolution in bits.

        Returns number

        The step in micro-degrees Celsius.

        If the resolution is not one the part offers.