Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cp2102n

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cp2102n - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

2

addon/cp2102n_node/CMakeLists.txt

@@ -20,4 +20,4 @@ project(cp2102n)

target_compile_definitions(${PROJECT_NAME} PRIVATE -DNAPI_VERSION=6)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DNAPI_VERSION=7)
target_link_libraries(${PROJECT_NAME} cp2102_usb)
import { Interface } from './binding';
declare class CP2102N {
private readonly intf;
private intf;
constructor(intf: Interface);

@@ -9,3 +9,3 @@ getRaw(): Promise<number>;

set(state: Record<number, boolean>): Promise<Record<number, boolean>>;
getSerialNumber(): Promise<string>;
getSerialNumber(): Promise<string | undefined>;
close(): void;

@@ -12,0 +12,0 @@ }

@@ -14,6 +14,6 @@ "use strict";

async getRaw() {
return await this.intf.get();
return await this.intf?.get() || 0;
}
async get() {
const read_bits = await this.intf.get();
const read_bits = await this.getRaw();
const result = {};

@@ -26,3 +26,3 @@ for (let i = 0; i < CP2102N_PORTS; i++) {

async setRaw(state, mask) {
return await this.intf.set(state, mask);
return await this.intf?.set(state, mask) || 0;
}

@@ -37,3 +37,3 @@ async set(state) {

}
const read_bits = await this.intf.set(write_bits, write_mask);
const read_bits = await this.setRaw(write_bits, write_mask);
const result = {};

@@ -46,6 +46,7 @@ for (let i = 0; i < CP2102N_PORTS; i++) {

async getSerialNumber() {
return await this.intf.getSerialNumber();
return await this.intf?.getSerialNumber();
}
close() {
this.intf.close();
this.intf?.close();
this.intf = undefined;
}

@@ -52,0 +53,0 @@ }

{
"name": "cp2102n",
"version": "0.2.2",
"version": "0.3.0",
"description": "Cross-platform Node.js binding for controlling GPIOs on Silicon Labs CP2102N",
"main": "lib/index.js",
"engines": {
"node": ">= 10.20.0"
"node": ">= 14.15.0"
},
"binary": {
"napi_versions": [
6
7
]

@@ -40,3 +40,3 @@ },

"devDependencies": {
"@tsconfig/node16-strictest": "^1.0.3",
"@tsconfig/node14": "^1.0.3",
"@types/node": "^18.0.3",

@@ -43,0 +43,0 @@ "typescript": "^4.7.4"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc