Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Cross-platform Node.js binding for controlling GPIOs on Silicon Labs CP2102N.
npm install --save cp2102n
This package shiped with prebuilt Node.js native addon for following platforms:
linux | darwin | win32 | |
---|---|---|---|
x64 | ✓ | ✓ | TODO |
arm | ✓ | n/a | n/a |
arm64 | ✓ | TODO |
npm install --save cp2102n --build-from-source
Additional build dependencies are required on different platforms:
sudo apt install -y build-essential cmake ninja-build pkg-config libusb-1.0-0-dev
brew install cmake ninja pkg-config libusb
sudo apt install -y libusb-1.0-0
brew install libusb
import { openInterface } from 'cp2102n';
try {
const device = await openInterface('/dev/cu.usbserial-1140');
await device.set({ [0]: true, [6]: true });
device.close();
} catch (e) {
console.error(e);
}
openInterface(path)
path
- string
Promise<CP2102N>
Open an interface with path
(i.e. /dev/cu.usbserialXXX
on macOS, /dev/ttyUSBX
on Linux). Throws if path
is not a valid CP2102N device.
CP2102N
cp2102n.set(state)
state
- { [pin: number]: boolean }
Promise<{ [pin: number]: boolean }>
Set state of pins to high (true
) or low (false
). Returns the latest state.
cp2102n.get()
Promise<{ [pin: number]: boolean }>
Get state of all PINs.
cp2102n.setRaw(state, mask)
state
- number
mask
- number
Promise<number>
Set state of masked pins in bits. Returns the latest state bits.
cp2102n.getRaw()
Promise<number>
Get state of pins in bits.
cp2102n.close()
Close interface.
FAQs
Cross-platform Node.js binding for controlling GPIOs on Silicon Labs CP2102N
We found that cp2102n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.