-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a5ac90
commit 2955772
Showing
1 changed file
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
# I²C Bus via MCP2221 | ||
# I²C Bus MCP2221 | ||
|
||
An [I²C interface](https://github.com/johntalton/and-other-delights) `I2CBus` implementation over [MCP2221](https://github.com/johntalton/mcp2221) | ||
|
||
A `I2CBus` implementation over `mcp2221` I²C interface | ||
|
||
[![npm Version](http://img.shields.io/npm/v/@johntalton/i2c-bus-mcp2221.svg)](https://www.npmjs.com/package/@johntalton/i2c-bus-mcp2221) | ||
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/i2c-bus-mcp2221) | ||
![CI](https://github.com/johntalton/i2c-bus-mcp2221/workflows/CI/badge.svg?branch=master&event=push) | ||
![CodeQL](https://github.com/johntalton/i2c-bus-mcp2221/workflows/CodeQL/badge.svg) | ||
![GitHub](https://img.shields.io/github/license/johntalton/i2c-bus-mcp2221) | ||
[![Downloads Per Month](http://img.shields.io/npm/dm/@johntalton/i2c-bus-mcp2221.svg)](https://www.npmjs.com/package/@johntalton/i2c-bus-mcp2221) | ||
![GitHub last commit](https://img.shields.io/github/last-commit/johntalton/i2c-bus-mcp2221) | ||
[![Package Quality](https://npm.packagequality.com/shield/%40johntalton%2Fi2c-bus-mcp2221.svg)](https://packagequality.com/#?package=@johntalton/i2c-bus-mcp2221) | ||
|
||
# | ||
|
||
```js | ||
|
||
import { MCP2221 } from '@johntalton/mcp2221' | ||
import { I2CBusMCP2221 } from '@johntalton/i2c-bus-mcp2221' | ||
|
||
const hidDevice = /* navigator.hid.request ... */ | ||
const source = new WebHIDStreamSource(hidDevice) // or NodeHIDStreamSource | ||
const device = MCP2221.from(source) | ||
const bus = I2CBusMCP2221.from(device) | ||
|
||
// bus.readI2CBlock(...) and friends | ||
``` |