Skip to content

Commit 87f20dc

Browse files
thegeckoarekzaluski
authored andcommitted
Update node examples
1 parent c367792 commit 87f20dc

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

examples/daplink-flash/hid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
const hid = require("node-hid");
2424
const common = require("./common");
25-
const DAPjs = require("../../");
25+
const hidTransport = require("../../lib/transport/hid");
2626

2727
// Allow user to select a device
2828
function selectDevice(vendorID) {
@@ -50,7 +50,7 @@ common.getFile()
5050
common.setupEmitter();
5151
return selectDevice(0xD28)
5252
.then(device => {
53-
const transport = new DAPjs.HID(device);
53+
const transport = new hidTransport.HID(device);
5454
return common.flash(transport, program);
5555
});
5656
})

examples/daplink-flash/usb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
const usb = require("usb");
2424
const common = require("./common");
25-
const DAPjs = require("../../");
25+
const usbTransport = require("../../lib/transport/usb");
2626

2727
// Read USB device descriptor
2828
function getStringDescriptor(device, index) {
@@ -69,7 +69,7 @@ common.getFile()
6969
common.setupEmitter();
7070
return selectDevice(0xD28)
7171
.then(device => {
72-
const transport = new DAPjs.USB(device);
72+
const transport = new usbTransport.USB(device);
7373
return common.flash(transport, program);
7474
});
7575
})

examples/daplink-serial/hid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
const hid = require("node-hid");
2424
const common = require("./common");
25-
const DAPjs = require("../../");
25+
const hidTransport = require("../../lib/transport/hid");
2626

2727
// Allow user to select a device
2828
function selectDevice(vendorID) {
@@ -56,7 +56,7 @@ function selectDevice(vendorID) {
5656

5757
selectDevice(0xD28)
5858
.then(device => {
59-
const transport = new DAPjs.HID(device);
59+
const transport = new hidTransport.HID(device);
6060
return common.listen(transport);
6161
})
6262
.catch(error => {

examples/daplink-serial/usb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
const usb = require("usb");
2424
const common = require("./common");
25-
const DAPjs = require("../../");
25+
const usbTransport = require("../../lib/transport/usb");
2626

2727
// Read USB device descriptor
2828
function getStringDescriptor(device, index) {
@@ -75,7 +75,7 @@ function selectDevice(vendorID) {
7575

7676
selectDevice(0xD28)
7777
.then(device => {
78-
const transport = new DAPjs.USB(device);
78+
const transport = new usbTransport.USB(device);
7979
return common.listen(transport);
8080
})
8181
.catch(error => {

examples/read-registers/hid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
const hid = require("node-hid");
2424
const common = require("./common");
25-
const DAPjs = require("../../");
25+
const hidTransport = require("../../lib/transport/hid");
2626

2727
// Allow user to select a device
2828
function selectDevice(vendorID) {
@@ -48,7 +48,7 @@ function selectDevice(vendorID) {
4848

4949
selectDevice(0xD28)
5050
.then(device => {
51-
const transport = new DAPjs.HID(device);
51+
const transport = new hidTransport.HID(device);
5252
return common.readRegisters(transport);
5353
})
5454
.then(() => {

examples/read-registers/usb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
const usb = require("usb");
2424
const common = require("./common");
25-
const DAPjs = require("../../");
25+
const usbTransport = require("../../lib/transport/usb");
2626

2727
// Read USB device descriptor
2828
function getStringDescriptor(device, index) {
@@ -66,7 +66,7 @@ function selectDevice(vendorID) {
6666

6767
selectDevice(0xD28)
6868
.then(device => {
69-
const transport = new DAPjs.USB(device);
69+
const transport = new usbTransport.USB(device);
7070
return common.readRegisters(transport);
7171
})
7272
.then(() => {

examples/typescript/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"@types/node": "^10.12.26",
1111
"browserify": "^16.2.3",
1212
"dapjs": "^1.1.0",
13-
"express": "^4.16.4",
1413
"tsify": "^4.0.1",
1514
"typescript": "^3.3.3",
1615
"webusb": "^1.1.1"

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"typescript": "~3.3.3",
6464
"usb": "^1.5.0",
6565
"vinyl-buffer": "^1.0.1",
66-
"vinyl-source-stream": "^2.0.0"
66+
"vinyl-source-stream": "^2.0.0",
67+
"webusb": "^1.1.1"
6768
}
6869
}

0 commit comments

Comments
 (0)