-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Showing
11 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
applications/system/js_app/examples/apps/Scripts/Examples/blebeacon.js
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
3 changes: 3 additions & 0 deletions
3
applications/system/js_app/examples/apps/Scripts/Examples/i2c.js
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
3 changes: 3 additions & 0 deletions
3
applications/system/js_app/examples/apps/Scripts/Examples/spi.js
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
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
3 changes: 3 additions & 0 deletions
3
applications/system/js_app/examples/apps/Scripts/Examples/subghz.js
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
31 changes: 29 additions & 2 deletions
31
applications/system/js_app/examples/apps/Scripts/Examples/usbdisk.js
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,39 @@ | ||
// Script cannot work without usbdisk module so check before | ||
checkSdkFeatures(["usbdisk"]); | ||
|
||
let usbdisk = require("usbdisk"); | ||
// print("Creating image..."); | ||
// usbdisk.createImage("/ext/apps_data/mass_storage/128MB.img", 128 * 1024 * 1024); | ||
let storage = require("storage"); | ||
|
||
let imagePath = "/ext/apps_data/mass_storage/128MB.img"; | ||
let imageSize = 128 * 1024 * 1024; | ||
|
||
let imageExisted = storage.fileExists(imagePath); | ||
if (imageExisted) { | ||
print("Disk image '128MB' already exists"); | ||
} else { | ||
// CreateImage isn't necessary to overall function, check when its used not at script start | ||
if (doesSdkSupport(["usbdisk-createimage"])) { | ||
print("Creating disk image '128MB'..."); | ||
usbdisk.createImage(imagePath, imageSize); | ||
} else { | ||
die("Disk image '128MB' not present, can't auto-create"); | ||
} | ||
} | ||
|
||
print("Starting UsbDisk..."); | ||
usbdisk.start("/ext/apps_data/mass_storage/128MB.img"); | ||
|
||
print("Started, waiting until ejected..."); | ||
while (!usbdisk.wasEjected()) { | ||
delay(1000); | ||
} | ||
|
||
print("Ejected, stopping UsbDisk..."); | ||
usbdisk.stop(); | ||
|
||
if (!imageExisted) { | ||
print("Removing disk image..."); | ||
storage.remove(imagePath); | ||
} | ||
|
||
print("Done"); |
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
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
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
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
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