# node-buspirate

> Node.js bindings for Bus Pirate

Latest version **0.0.1** (published 2013-07-04) · BSD license · 0 weekly downloads

## Install

```sh
npm install node-buspirate
pnpm add node-buspirate
yarn add node-buspirate
bun add node-buspirate
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2013-07-04 |
| First published | 2013-07-04 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Ricardo da Silva |
| Maintainers | rmhsilva |

## Links

- npm: https://www.npmjs.com/package/node-buspirate
- Repository: https://github.com/rmhsilva/node-buspirate
- npm.io page: https://npm.io/package/node-buspirate

## Dependencies (3)

- [colors](https://npm.io/package/colors.md) *
- [asyncblock](https://npm.io/package/asyncblock.md) *
- [serialport](https://npm.io/package/serialport.md) *

## Recent versions

- 0.0.1 (latest) — 2013-07-04

## README

#node-buspirate

In the works: [Bus pirate](http://dangerousprototypes.com/docs/Bus_Pirate) bindings for [Node.js](http://nodejs.org), letting you control a Bus Pirate from any Node.js script.

The code is fairly untested, and may break your kit.  However, these modes have been mostly implemented, and partially tested:

* UART (Read/Write/Bridge)
* SPI (Sniff/Write-read)


##Install

node-buspirate is in the npm registry!

	npm install node-buspirate

Or you could always clone / fork this repo:

	git clone https://github.com/rmhsilva/node-buspirate.git
	cd node-buspirate && npm install


##Usage

Check the [examples](https://github.com/rmhsilva/node-buspirate/tree/master/examples) folder for examples of how it can be used.

Basic idea:
```javascript
#!/usr/bin/env node

var BusPirate = require('./node-buspirate');
var pirate = new BusPirate('/dev/bus_pirate');

pirate.on('connected', function() {
	pirate.uart.start({
		baudrate: 115200,
		stop_bits: 1,
		data_bits: 8  // ... and other options
	});
});

pirate.uart.on('ready', function() {
	pirate.config_periph(true,true,true,true);
	pirate.uart.echo_rx(true);

	setInterval(function() {
		pirate.uart.write('ping UART\r\n');
	}, 3000);
});

pirate.uart.on('data', function(data) {
	process.stdout.write(data);
});	
```

The plan is to add other Bus Pirate modes (I2C...) which will be used similarly.


##How

The BusPirate object is an eventEmitter built on top of a node Serialport.  It gets the hardware into raw bitbang mode, then just sends and receives raw data from the hardware, and lets other modules handle the specifics of each mode.


##todo

* Write modules to handle other BusPirate modes.
* Documentation
* And much more...


Although Javascript is probably not often used for hardware debugging, this project has been an interesting experiment which has proved to be useful.  It was started because I don't like Python and the Ruby bus pirate bindings weren't working.

---
_Source: https://npm.io/package/node-buspirate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
