-
-
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
6 changed files
with
50 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/js_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/js_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
6 changes: 5 additions & 1 deletion
6
applications/system/js_app/examples/apps/Scripts/js_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
3 changes: 3 additions & 0 deletions
3
applications/system/js_app/examples/apps/Scripts/js_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
29 changes: 29 additions & 0 deletions
29
applications/system/js_app/examples/apps/Scripts/js_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,10 +1,39 @@ | ||
// Script cannot work without usbdisk module so check before | ||
checkSdkFeatures(["usbdisk"]); | ||
|
||
let usbdisk = require("usbdisk"); | ||
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"); |
11 changes: 7 additions & 4 deletions
11
applications/system/js_app/examples/apps/Scripts/js_examples/widget.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