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

    Variable pwmConst

    pwm: {
        counts(bytes: Uint8Array): { off: number; on: number };
        duty(off: number): Buffer;
        fromCounts(on: number, off: number): Buffer;
        fullOff(): Buffer;
        fullOn(): Buffer;
        servo(pulseMicros: number, updateRateHz?: number): Buffer;
    } = ...

    The four register bytes for one PCA9685 channel.

    Each call returns a buffer in the channel's own register order, so it can be written in a single bus transaction.

    Type Declaration

    • counts: function
      • Reads a setting back from the four register bytes a channel holds.

        The inverse of the builders above, so a caller can read a channel off the bus and see what it is set to rather than decoding the registers by hand.

        Parameters

        • bytes: Uint8Array

          The four channel registers.

        Returns { off: number; on: number }

        The counts at which the output goes high and low.

        If the buffer is not four bytes.

    • duty: function
      • Builds a setting with no phase delay: on at count 0, off at off.

        Parameters

        • off: number

          The count at which the output goes low, which sets the duty.

        Returns Buffer

        The four register bytes.

    • fromCounts: function
      • Builds a setting from explicit on and off counts.

        Parameters

        • on: number

          The count at which the output goes high.

        • off: number

          The count at which it goes low.

        Returns Buffer

        The four register bytes; counts are masked to 12 bits.

    • fullOff: function
      • The setting that holds a channel continuously low, the power-on state.

        Returns Buffer

        The four register bytes. This is not the same as a zero duty, which still glitches high for one count.

    • fullOn: function
    • servo: function
      • Builds the setting that drives a hobby servo to a pulse width.

        Parameters

        • pulseMicros: number

          The high-pulse width in microseconds. Typical travel is about 1000 to 2000 microseconds.

        • updateRateHz: number = 50

          The PWM frequency the controller is set to, usually 50.

        Returns Buffer

        The four register bytes.