# nixfilter-rpi-gpio

[Filter](https://en.wikipedia.org/wiki/Filter_(software)#Unix)" *(non-interactive command-line tool reading from STDIN and writing to STDOUT)* for sending binary signal sequences via the GPIO pin of a Raspberry Pi.

## Installation

    $ npm install -g nixfilter-rpi-gpio

Requires [Node.js](https://nodejs.org/). Must be run directly on a Raspberry Pi.

## Command-line tools

### `nixfilter-rpi-gpio-send`

*nixfilter-rpi-gpio-send* sends logic/binary signals via a GPIO pin of a Raspberry Pi. The logic/binary signals are read as lines from STDIN, as comma-separated integer values representing durations in nanoseconds. Negative values indicate "inactive"/"low" levels, positive values indicate "active"/"high" levels. For example, the input line "360000,-1080000,+1080000,360000" would output a binary signal of 360µs "high" level, followed by 1080µs "low" level, followed by 1080µs "high" level, followed by 360µs "low" level, on the specified GPIO pin.

    $ nixfilter-rpi-gpio-send -h
    
    usage: nixfilter-rpi-gpio-send [-h] [--latency LATENCY] [--inactive_state {low,high}]
                                   gpio_pin_id
    
    Send logic/binary signals via a GPIO pin of a Raspberry Pi. The logic/binary 
    signals are read as lines from STDIN, as comma-separated integer values 
    representing durations in nanoseconds. Negative values indicate 
    "inactive"/"low" levels, positive values indicate "active"/"high" levels. For 
    example, the input line "360000,-1080000,+1080000,360000" would output a 
    binary signal of 360µs "high" level, followed by 1080µs "low" level, followed 
    by 1080µs "high" level, followed by 360µs "low" level.
    
    Positional arguments:
      gpio_pin_id           The numerical ID of the GPIO pin to use for 
                            outputting the signals
    
    Optional arguments:
      -h, --help            Show this help message and exit.
      --latency LATENCY, -l LATENCY
                            The latency overhead (in microseconds) for every 
                            signal. This depends on the Raspberry Pi being used; 
                            on the Raspberry Pi 3B+, this is about 65. (default: 
                            65)
      --inactive_state {low,high}, -i {low,high}
                            The GPIO pin's inactive state, if no signal is being 
                            sent (default: low)
