@microbit/microbit-connection 0.9.0-apps.alpha.9 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -27
- package/build/cjs/async-util.d.ts +3 -1
- package/build/cjs/async-util.js +5 -1
- package/build/cjs/async-util.js.map +1 -1
- package/build/cjs/availability.js.map +1 -1
- package/build/cjs/bluetooth/ble-error.d.ts +10 -0
- package/build/cjs/bluetooth/ble-error.js +47 -0
- package/build/cjs/bluetooth/ble-error.js.map +1 -0
- package/build/cjs/bluetooth/connection.d.ts +378 -0
- package/build/cjs/bluetooth/connection.js +623 -0
- package/build/cjs/bluetooth/connection.js.map +1 -0
- package/build/cjs/bluetooth/device-bond-state.d.ts +14 -0
- package/build/cjs/bluetooth/device-bond-state.js +26 -0
- package/build/cjs/bluetooth/device-bond-state.js.map +1 -0
- package/build/cjs/{bluetooth-device-wrapper.d.ts → bluetooth/device-wrapper.d.ts} +36 -21
- package/build/cjs/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +174 -147
- package/build/cjs/bluetooth/device-wrapper.js.map +1 -0
- package/build/{esm → cjs/bluetooth}/flashing/flashing-full.d.ts +2 -2
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-full.js +6 -5
- package/build/cjs/bluetooth/flashing/flashing-full.js.map +1 -0
- package/build/cjs/bluetooth/flashing/flashing-makecode.d.ts +10 -0
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-makecode.js +5 -2
- package/build/cjs/bluetooth/flashing/flashing-makecode.js.map +1 -0
- package/build/cjs/bluetooth/flashing/flashing-partial.d.ts +10 -0
- package/build/cjs/bluetooth/flashing/flashing-partial.js +145 -0
- package/build/cjs/bluetooth/flashing/flashing-partial.js.map +1 -0
- package/build/cjs/bluetooth/flashing/flashing-v1.js.map +1 -0
- package/build/cjs/{flashing → bluetooth/flashing}/nordic-dfu.d.ts +2 -2
- package/build/cjs/{flashing → bluetooth/flashing}/nordic-dfu.js +41 -15
- package/build/cjs/bluetooth/flashing/nordic-dfu.js.map +1 -0
- package/build/cjs/bluetooth/flashing/zip.js.map +1 -0
- package/build/cjs/bluetooth/index.d.ts +5 -0
- package/build/cjs/bluetooth/index.js +9 -0
- package/build/cjs/bluetooth/index.js.map +1 -0
- package/build/cjs/{bluetooth-profile.d.ts → bluetooth/profile.d.ts} +8 -0
- package/build/cjs/{bluetooth-profile.js → bluetooth/profile.js} +7 -1
- package/build/cjs/bluetooth/profile.js.map +1 -0
- package/build/cjs/{accelerometer-service.d.ts → bluetooth/services/accelerometer-service.d.ts} +2 -3
- package/build/cjs/{accelerometer-service.js → bluetooth/services/accelerometer-service.js} +17 -12
- package/build/cjs/bluetooth/services/accelerometer-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/button-service.d.ts +2 -3
- package/build/cjs/{button-service.js → bluetooth/services/button-service.js} +24 -14
- package/build/cjs/bluetooth/services/button-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/device-information-service.d.ts +1 -1
- package/build/cjs/bluetooth/services/device-information-service.js +29 -0
- package/build/cjs/bluetooth/services/device-information-service.js.map +1 -0
- package/build/cjs/{dfu-service.js → bluetooth/services/dfu-service.js} +2 -2
- package/build/cjs/bluetooth/services/dfu-service.js.map +1 -0
- package/build/cjs/bluetooth/services/event-service.d.ts +48 -0
- package/build/cjs/bluetooth/services/event-service.js +273 -0
- package/build/cjs/bluetooth/services/event-service.js.map +1 -0
- package/build/cjs/bluetooth/services/io-pin-service.d.ts +65 -0
- package/build/cjs/bluetooth/services/io-pin-service.js +173 -0
- package/build/cjs/bluetooth/services/io-pin-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/led-service.d.ts +2 -3
- package/build/cjs/{led-service.js → bluetooth/services/led-service.js} +10 -7
- package/build/cjs/bluetooth/services/led-service.js.map +1 -0
- package/build/cjs/{magnetometer-service.d.ts → bluetooth/services/magnetometer-service.d.ts} +2 -3
- package/build/cjs/{magnetometer-service.js → bluetooth/services/magnetometer-service.js} +19 -14
- package/build/cjs/bluetooth/services/magnetometer-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/partial-flashing-service.d.ts +1 -1
- package/build/cjs/{partial-flashing-service.js → bluetooth/services/partial-flashing-service.js} +8 -8
- package/build/cjs/bluetooth/services/partial-flashing-service.js.map +1 -0
- package/build/cjs/bluetooth/services/temperature-service.d.ts +14 -0
- package/build/cjs/bluetooth/services/temperature-service.js +80 -0
- package/build/cjs/bluetooth/services/temperature-service.js.map +1 -0
- package/build/cjs/{uart-service.d.ts → bluetooth/services/uart-service.d.ts} +2 -2
- package/build/cjs/{uart-service.js → bluetooth/services/uart-service.js} +21 -9
- package/build/cjs/bluetooth/services/uart-service.js.map +1 -0
- package/build/cjs/board-id.d.ts +1 -1
- package/build/cjs/board-id.js.map +1 -1
- package/build/cjs/device.d.ts +191 -101
- package/build/cjs/device.js +47 -110
- package/build/cjs/device.js.map +1 -1
- package/build/cjs/events.d.ts +8 -108
- package/build/cjs/events.js +27 -88
- package/build/cjs/events.js.map +1 -1
- package/build/cjs/hex-util.d.ts +1 -0
- package/build/cjs/hex-util.js +15 -0
- package/build/cjs/hex-util.js.map +1 -0
- package/build/cjs/index.d.ts +8 -16
- package/build/cjs/index.js +9 -28
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/logging.js.map +1 -1
- package/build/cjs/microbit-events.d.ts +67 -0
- package/build/cjs/microbit-events.js +55 -0
- package/build/cjs/microbit-events.js.map +1 -0
- package/build/cjs/radio-bridge/connection.d.ts +52 -0
- package/build/cjs/{usb-radio-bridge.js → radio-bridge/connection.js} +84 -96
- package/build/cjs/radio-bridge/connection.js.map +1 -0
- package/build/cjs/radio-bridge/index.d.ts +4 -0
- package/build/cjs/radio-bridge/index.js +9 -0
- package/build/cjs/radio-bridge/index.js.map +1 -0
- package/build/cjs/{usb-serial-protocol.js → radio-bridge/serial-protocol.js} +1 -1
- package/build/cjs/radio-bridge/serial-protocol.js.map +1 -0
- package/build/cjs/service-events.d.ts +92 -15
- package/build/cjs/service-events.js +6 -36
- package/build/cjs/service-events.js.map +1 -1
- package/build/{esm/hex-flash-data-source.d.ts → cjs/universal-hex/flash-data-source.d.ts} +1 -1
- package/build/cjs/{hex-flash-data-source.js → universal-hex/flash-data-source.js} +6 -3
- package/build/cjs/universal-hex/flash-data-source.js.map +1 -0
- package/build/cjs/universal-hex/index.d.ts +4 -0
- package/build/cjs/universal-hex/index.js +9 -0
- package/build/cjs/universal-hex/index.js.map +1 -0
- package/build/cjs/usb/arm-debug.d.ts +137 -0
- package/build/cjs/usb/arm-debug.js +414 -0
- package/build/cjs/usb/arm-debug.js.map +1 -0
- package/build/{esm → cjs/usb}/board-serial-info.d.ts +2 -1
- package/build/cjs/{board-serial-info.js → usb/board-serial-info.js} +10 -7
- package/build/cjs/usb/board-serial-info.js.map +1 -0
- package/build/cjs/usb/cdc-saturation.d.ts +36 -0
- package/build/cjs/usb/cdc-saturation.js +151 -0
- package/build/cjs/usb/cdc-saturation.js.map +1 -0
- package/build/cjs/usb/cmsis-dap.d.ts +113 -0
- package/build/cjs/usb/cmsis-dap.js +349 -0
- package/build/cjs/usb/cmsis-dap.js.map +1 -0
- package/build/cjs/usb/connection.d.ts +96 -0
- package/build/cjs/{usb.js → usb/connection.js} +257 -173
- package/build/cjs/usb/connection.js.map +1 -0
- package/build/cjs/usb/cortex-m.d.ts +72 -0
- package/build/cjs/usb/cortex-m.js +165 -0
- package/build/cjs/usb/cortex-m.js.map +1 -0
- package/build/cjs/usb/daplink.d.ts +69 -0
- package/build/cjs/usb/daplink.js +238 -0
- package/build/cjs/usb/daplink.js.map +1 -0
- package/build/cjs/usb/device-wrapper.d.ts +34 -0
- package/build/cjs/usb/device-wrapper.js +102 -0
- package/build/cjs/usb/device-wrapper.js.map +1 -0
- package/build/cjs/usb/index.d.ts +5 -0
- package/build/cjs/usb/index.js +10 -0
- package/build/cjs/usb/index.js.map +1 -0
- package/build/{esm/usb-partial-flashing-utils.d.ts → cjs/usb/partial-flashing-utils.d.ts} +6 -9
- package/build/cjs/{usb-partial-flashing-utils.js → usb/partial-flashing-utils.js} +6 -49
- package/build/cjs/usb/partial-flashing-utils.js.map +1 -0
- package/build/{esm/usb-partial-flashing.d.ts → cjs/usb/partial-flashing.d.ts} +37 -11
- package/build/cjs/{usb-partial-flashing.js → usb/partial-flashing.js} +170 -134
- package/build/cjs/usb/partial-flashing.js.map +1 -0
- package/build/cjs/usb/promise-queue.js.map +1 -0
- package/build/cjs/usb/serial-events.d.ts +16 -0
- package/build/cjs/{led.js → usb/serial-events.js} +1 -1
- package/build/cjs/usb/serial-events.js.map +1 -0
- package/build/cjs/usb/transport.d.ts +42 -0
- package/build/cjs/usb/transport.js +155 -0
- package/build/cjs/usb/transport.js.map +1 -0
- package/build/esm/async-util.d.ts +3 -1
- package/build/esm/async-util.js +5 -1
- package/build/esm/async-util.js.map +1 -1
- package/build/esm/availability.js.map +1 -1
- package/build/esm/bluetooth/ble-error.d.ts +10 -0
- package/build/esm/bluetooth/ble-error.js +42 -0
- package/build/esm/bluetooth/ble-error.js.map +1 -0
- package/build/esm/bluetooth/connection.d.ts +378 -0
- package/build/esm/bluetooth/connection.js +593 -0
- package/build/esm/bluetooth/connection.js.map +1 -0
- package/build/esm/bluetooth/device-bond-state.d.ts +14 -0
- package/build/esm/bluetooth/device-bond-state.js +22 -0
- package/build/esm/bluetooth/device-bond-state.js.map +1 -0
- package/build/esm/{bluetooth-device-wrapper.d.ts → bluetooth/device-wrapper.d.ts} +36 -21
- package/build/esm/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +172 -146
- package/build/esm/bluetooth/device-wrapper.js.map +1 -0
- package/build/{cjs → esm/bluetooth}/flashing/flashing-full.d.ts +2 -2
- package/build/esm/{flashing → bluetooth/flashing}/flashing-full.js +6 -5
- package/build/esm/bluetooth/flashing/flashing-full.js.map +1 -0
- package/build/esm/bluetooth/flashing/flashing-makecode.d.ts +10 -0
- package/build/esm/{flashing → bluetooth/flashing}/flashing-makecode.js +5 -2
- package/build/esm/bluetooth/flashing/flashing-makecode.js.map +1 -0
- package/build/esm/bluetooth/flashing/flashing-partial.d.ts +10 -0
- package/build/esm/bluetooth/flashing/flashing-partial.js +142 -0
- package/build/esm/bluetooth/flashing/flashing-partial.js.map +1 -0
- package/build/esm/bluetooth/flashing/flashing-v1.js.map +1 -0
- package/build/esm/{flashing → bluetooth/flashing}/nordic-dfu.d.ts +2 -2
- package/build/esm/{flashing → bluetooth/flashing}/nordic-dfu.js +41 -15
- package/build/esm/bluetooth/flashing/nordic-dfu.js.map +1 -0
- package/build/esm/bluetooth/flashing/zip.js.map +1 -0
- package/build/esm/bluetooth/index.d.ts +5 -0
- package/build/esm/bluetooth/index.js +5 -0
- package/build/esm/bluetooth/index.js.map +1 -0
- package/build/esm/{bluetooth-profile.d.ts → bluetooth/profile.d.ts} +8 -0
- package/build/esm/{bluetooth-profile.js → bluetooth/profile.js} +7 -1
- package/build/{cjs/bluetooth-profile.js.map → esm/bluetooth/profile.js.map} +1 -1
- package/build/esm/{accelerometer-service.d.ts → bluetooth/services/accelerometer-service.d.ts} +2 -3
- package/build/esm/{accelerometer-service.js → bluetooth/services/accelerometer-service.js} +11 -6
- package/build/esm/bluetooth/services/accelerometer-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/button-service.d.ts +2 -3
- package/build/esm/{button-service.js → bluetooth/services/button-service.js} +20 -10
- package/build/esm/bluetooth/services/button-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/device-information-service.d.ts +1 -1
- package/build/esm/bluetooth/services/device-information-service.js +25 -0
- package/build/esm/bluetooth/services/device-information-service.js.map +1 -0
- package/build/esm/{dfu-service.js → bluetooth/services/dfu-service.js} +1 -1
- package/build/esm/bluetooth/services/dfu-service.js.map +1 -0
- package/build/esm/bluetooth/services/event-service.d.ts +48 -0
- package/build/esm/bluetooth/services/event-service.js +269 -0
- package/build/esm/bluetooth/services/event-service.js.map +1 -0
- package/build/esm/bluetooth/services/io-pin-service.d.ts +65 -0
- package/build/esm/bluetooth/services/io-pin-service.js +169 -0
- package/build/esm/bluetooth/services/io-pin-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/led-service.d.ts +2 -3
- package/build/esm/{led-service.js → bluetooth/services/led-service.js} +4 -1
- package/build/esm/bluetooth/services/led-service.js.map +1 -0
- package/build/esm/{magnetometer-service.d.ts → bluetooth/services/magnetometer-service.d.ts} +2 -3
- package/build/esm/{magnetometer-service.js → bluetooth/services/magnetometer-service.js} +11 -6
- package/build/esm/bluetooth/services/magnetometer-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/partial-flashing-service.d.ts +1 -1
- package/build/esm/{partial-flashing-service.js → bluetooth/services/partial-flashing-service.js} +4 -4
- package/build/esm/bluetooth/services/partial-flashing-service.js.map +1 -0
- package/build/esm/bluetooth/services/temperature-service.d.ts +14 -0
- package/build/esm/bluetooth/services/temperature-service.js +76 -0
- package/build/esm/bluetooth/services/temperature-service.js.map +1 -0
- package/build/esm/{uart-service.d.ts → bluetooth/services/uart-service.d.ts} +2 -2
- package/build/esm/{uart-service.js → bluetooth/services/uart-service.js} +18 -6
- package/build/esm/bluetooth/services/uart-service.js.map +1 -0
- package/build/esm/board-id.d.ts +1 -1
- package/build/esm/board-id.js.map +1 -1
- package/build/esm/device.d.ts +191 -101
- package/build/esm/device.js +45 -104
- package/build/esm/device.js.map +1 -1
- package/build/esm/events.d.ts +8 -108
- package/build/esm/events.js +26 -86
- package/build/esm/events.js.map +1 -1
- package/build/esm/hex-util.d.ts +1 -0
- package/build/esm/hex-util.js +11 -0
- package/build/esm/hex-util.js.map +1 -0
- package/build/esm/index.d.ts +8 -16
- package/build/esm/index.js +7 -11
- package/build/esm/index.js.map +1 -1
- package/build/esm/logging.js.map +1 -1
- package/build/esm/microbit-events.d.ts +67 -0
- package/build/esm/microbit-events.js +52 -0
- package/build/esm/microbit-events.js.map +1 -0
- package/build/esm/radio-bridge/connection.d.ts +52 -0
- package/build/esm/{usb-radio-bridge.js → radio-bridge/connection.js} +84 -96
- package/build/esm/radio-bridge/connection.js.map +1 -0
- package/build/esm/radio-bridge/index.d.ts +4 -0
- package/build/esm/radio-bridge/index.js +5 -0
- package/build/esm/radio-bridge/index.js.map +1 -0
- package/build/esm/{usb-serial-protocol.js → radio-bridge/serial-protocol.js} +1 -1
- package/build/esm/radio-bridge/serial-protocol.js.map +1 -0
- package/build/esm/service-events.d.ts +92 -15
- package/build/esm/service-events.js +5 -34
- package/build/esm/service-events.js.map +1 -1
- package/build/{cjs/hex-flash-data-source.d.ts → esm/universal-hex/flash-data-source.d.ts} +1 -1
- package/build/esm/{hex-flash-data-source.js → universal-hex/flash-data-source.js} +6 -3
- package/build/esm/universal-hex/flash-data-source.js.map +1 -0
- package/build/esm/universal-hex/index.d.ts +4 -0
- package/build/esm/universal-hex/index.js +5 -0
- package/build/esm/universal-hex/index.js.map +1 -0
- package/build/esm/usb/arm-debug.d.ts +137 -0
- package/build/esm/usb/arm-debug.js +409 -0
- package/build/esm/usb/arm-debug.js.map +1 -0
- package/build/{cjs → esm/usb}/board-serial-info.d.ts +2 -1
- package/build/esm/{board-serial-info.js → usb/board-serial-info.js} +10 -7
- package/build/esm/usb/board-serial-info.js.map +1 -0
- package/build/esm/usb/cdc-saturation.d.ts +36 -0
- package/build/esm/usb/cdc-saturation.js +148 -0
- package/build/esm/usb/cdc-saturation.js.map +1 -0
- package/build/esm/usb/cmsis-dap.d.ts +113 -0
- package/build/esm/usb/cmsis-dap.js +342 -0
- package/build/esm/usb/cmsis-dap.js.map +1 -0
- package/build/esm/usb/connection.d.ts +96 -0
- package/build/esm/{usb.js → usb/connection.js} +253 -168
- package/build/esm/usb/connection.js.map +1 -0
- package/build/esm/usb/cortex-m.d.ts +72 -0
- package/build/esm/usb/cortex-m.js +161 -0
- package/build/esm/usb/cortex-m.js.map +1 -0
- package/build/esm/usb/daplink.d.ts +69 -0
- package/build/esm/usb/daplink.js +231 -0
- package/build/esm/usb/daplink.js.map +1 -0
- package/build/esm/usb/device-wrapper.d.ts +34 -0
- package/build/esm/usb/device-wrapper.js +98 -0
- package/build/esm/usb/device-wrapper.js.map +1 -0
- package/build/esm/usb/index.d.ts +5 -0
- package/build/esm/usb/index.js +5 -0
- package/build/esm/usb/index.js.map +1 -0
- package/build/{cjs/usb-partial-flashing-utils.d.ts → esm/usb/partial-flashing-utils.d.ts} +6 -9
- package/build/esm/{usb-partial-flashing-utils.js → usb/partial-flashing-utils.js} +4 -44
- package/build/esm/usb/partial-flashing-utils.js.map +1 -0
- package/build/{cjs/usb-partial-flashing.d.ts → esm/usb/partial-flashing.d.ts} +37 -11
- package/build/esm/{usb-partial-flashing.js → usb/partial-flashing.js} +169 -110
- package/build/esm/usb/partial-flashing.js.map +1 -0
- package/build/esm/usb/promise-queue.js.map +1 -0
- package/build/esm/usb/serial-events.d.ts +16 -0
- package/build/esm/usb/serial-events.js +2 -0
- package/build/esm/usb/serial-events.js.map +1 -0
- package/build/esm/usb/transport.d.ts +42 -0
- package/build/esm/usb/transport.js +151 -0
- package/build/esm/usb/transport.js.map +1 -0
- package/package.json +61 -14
- package/build/cjs/accelerometer-service.js.map +0 -1
- package/build/cjs/accelerometer.d.ts +0 -9
- package/build/cjs/accelerometer.js +0 -16
- package/build/cjs/accelerometer.js.map +0 -1
- package/build/cjs/bluetooth-device-wrapper.js.map +0 -1
- package/build/cjs/bluetooth.d.ts +0 -112
- package/build/cjs/bluetooth.js +0 -457
- package/build/cjs/bluetooth.js.map +0 -1
- package/build/cjs/board-serial-info.js.map +0 -1
- package/build/cjs/button-service.js.map +0 -1
- package/build/cjs/buttons.d.ts +0 -10
- package/build/cjs/buttons.js +0 -22
- package/build/cjs/buttons.js.map +0 -1
- package/build/cjs/constants.d.ts +0 -48
- package/build/cjs/constants.js +0 -73
- package/build/cjs/constants.js.map +0 -1
- package/build/cjs/device-information-service.js +0 -34
- package/build/cjs/device-information-service.js.map +0 -1
- package/build/cjs/dfu-service.js.map +0 -1
- package/build/cjs/flashing/flashing-full.js.map +0 -1
- package/build/cjs/flashing/flashing-makecode.d.ts +0 -6
- package/build/cjs/flashing/flashing-makecode.js.map +0 -1
- package/build/cjs/flashing/flashing-partial.d.ts +0 -9
- package/build/cjs/flashing/flashing-partial.js +0 -98
- package/build/cjs/flashing/flashing-partial.js.map +0 -1
- package/build/cjs/flashing/flashing-v1.js.map +0 -1
- package/build/cjs/flashing/nordic-dfu.js.map +0 -1
- package/build/cjs/flashing/zip.js.map +0 -1
- package/build/cjs/hex-flash-data-source.js.map +0 -1
- package/build/cjs/led-service.js.map +0 -1
- package/build/cjs/led.d.ts +0 -6
- package/build/cjs/led.js.map +0 -1
- package/build/cjs/magnetometer-service.js.map +0 -1
- package/build/cjs/magnetometer.d.ts +0 -9
- package/build/cjs/magnetometer.js +0 -16
- package/build/cjs/magnetometer.js.map +0 -1
- package/build/cjs/partial-flashing-service.js.map +0 -1
- package/build/cjs/promise-queue.js.map +0 -1
- package/build/cjs/serial-events.d.ts +0 -20
- package/build/cjs/serial-events.js +0 -69
- package/build/cjs/serial-events.js.map +0 -1
- package/build/cjs/setupTests.d.ts +0 -6
- package/build/cjs/setupTests.js.map +0 -1
- package/build/cjs/uart-service.js.map +0 -1
- package/build/cjs/uart.d.ts +0 -4
- package/build/cjs/uart.js +0 -16
- package/build/cjs/uart.js.map +0 -1
- package/build/cjs/usb-device-wrapper.d.ts +0 -47
- package/build/cjs/usb-device-wrapper.js +0 -437
- package/build/cjs/usb-device-wrapper.js.map +0 -1
- package/build/cjs/usb-partial-flashing-utils.js.map +0 -1
- package/build/cjs/usb-partial-flashing.js.map +0 -1
- package/build/cjs/usb-radio-bridge.d.ts +0 -24
- package/build/cjs/usb-radio-bridge.js.map +0 -1
- package/build/cjs/usb-serial-protocol.js.map +0 -1
- package/build/cjs/usb.d.ts +0 -66
- package/build/cjs/usb.js.map +0 -1
- package/build/esm/accelerometer-service.js.map +0 -1
- package/build/esm/accelerometer.d.ts +0 -9
- package/build/esm/accelerometer.js +0 -12
- package/build/esm/accelerometer.js.map +0 -1
- package/build/esm/bluetooth-device-wrapper.js.map +0 -1
- package/build/esm/bluetooth-profile.js.map +0 -1
- package/build/esm/bluetooth.d.ts +0 -112
- package/build/esm/bluetooth.js +0 -427
- package/build/esm/bluetooth.js.map +0 -1
- package/build/esm/board-serial-info.js.map +0 -1
- package/build/esm/button-service.js.map +0 -1
- package/build/esm/buttons.d.ts +0 -10
- package/build/esm/buttons.js +0 -18
- package/build/esm/buttons.js.map +0 -1
- package/build/esm/constants.d.ts +0 -48
- package/build/esm/constants.js +0 -70
- package/build/esm/constants.js.map +0 -1
- package/build/esm/device-information-service.js +0 -30
- package/build/esm/device-information-service.js.map +0 -1
- package/build/esm/dfu-service.js.map +0 -1
- package/build/esm/flashing/flashing-full.js.map +0 -1
- package/build/esm/flashing/flashing-makecode.d.ts +0 -6
- package/build/esm/flashing/flashing-makecode.js.map +0 -1
- package/build/esm/flashing/flashing-partial.d.ts +0 -9
- package/build/esm/flashing/flashing-partial.js +0 -95
- package/build/esm/flashing/flashing-partial.js.map +0 -1
- package/build/esm/flashing/flashing-v1.js.map +0 -1
- package/build/esm/flashing/nordic-dfu.js.map +0 -1
- package/build/esm/flashing/zip.js.map +0 -1
- package/build/esm/hex-flash-data-source.js.map +0 -1
- package/build/esm/led-service.js.map +0 -1
- package/build/esm/led.d.ts +0 -6
- package/build/esm/led.js +0 -2
- package/build/esm/led.js.map +0 -1
- package/build/esm/magnetometer-service.js.map +0 -1
- package/build/esm/magnetometer.d.ts +0 -9
- package/build/esm/magnetometer.js +0 -12
- package/build/esm/magnetometer.js.map +0 -1
- package/build/esm/partial-flashing-service.js.map +0 -1
- package/build/esm/promise-queue.js.map +0 -1
- package/build/esm/serial-events.d.ts +0 -20
- package/build/esm/serial-events.js +0 -61
- package/build/esm/serial-events.js.map +0 -1
- package/build/esm/setupTests.d.ts +0 -6
- package/build/esm/setupTests.js.map +0 -1
- package/build/esm/uart-service.js.map +0 -1
- package/build/esm/uart.d.ts +0 -4
- package/build/esm/uart.js +0 -12
- package/build/esm/uart.js.map +0 -1
- package/build/esm/usb-device-wrapper.d.ts +0 -47
- package/build/esm/usb-device-wrapper.js +0 -410
- package/build/esm/usb-device-wrapper.js.map +0 -1
- package/build/esm/usb-partial-flashing-utils.js.map +0 -1
- package/build/esm/usb-partial-flashing.js.map +0 -1
- package/build/esm/usb-radio-bridge.d.ts +0 -24
- package/build/esm/usb-radio-bridge.js.map +0 -1
- package/build/esm/usb-serial-protocol.js.map +0 -1
- package/build/esm/usb.d.ts +0 -66
- package/build/esm/usb.js.map +0 -1
- package/typedoc.json +0 -14
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-v1.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-v1.js +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.js +0 -0
- /package/build/cjs/{dfu-service.d.ts → bluetooth/services/dfu-service.d.ts} +0 -0
- /package/build/cjs/{usb-serial-protocol.d.ts → radio-bridge/serial-protocol.d.ts} +0 -0
- /package/build/cjs/{promise-queue.d.ts → usb/promise-queue.d.ts} +0 -0
- /package/build/cjs/{promise-queue.js → usb/promise-queue.js} +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/flashing-v1.d.ts +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/flashing-v1.js +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/zip.d.ts +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/zip.js +0 -0
- /package/build/esm/{dfu-service.d.ts → bluetooth/services/dfu-service.d.ts} +0 -0
- /package/build/esm/{usb-serial-protocol.d.ts → radio-bridge/serial-protocol.d.ts} +0 -0
- /package/build/esm/{promise-queue.d.ts → usb/promise-queue.d.ts} +0 -0
- /package/build/esm/{promise-queue.js → usb/promise-queue.js} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) 2021, Micro:bit Educational Foundation and contributors
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { BoardSerialInfo } from "./board-serial-info.js";
|
|
7
|
+
import { ArmDebugSwd } from "./arm-debug.js";
|
|
8
|
+
import { CmsisDapUsb } from "./cmsis-dap.js";
|
|
9
|
+
import { CortexM } from "./cortex-m.js";
|
|
10
|
+
import { DapLinkSerial, readDaplinkUniqueId, readMem32WithRetry, } from "./daplink.js";
|
|
11
|
+
import { UsbTransport } from "./transport.js";
|
|
12
|
+
// FICR Registers (Nordic nRF SoC Factory Information Configuration)
|
|
13
|
+
// https://docs.nordicsemi.com/bundle/ps_nrf52833/page/ficr.html
|
|
14
|
+
const FICR_CODEPAGESIZE = 0x10000010;
|
|
15
|
+
const FICR_CODESIZE = 0x10000014;
|
|
16
|
+
const FICR_DEVICE_ID_1 = 0x10000064;
|
|
17
|
+
export class USBDeviceWrapper {
|
|
18
|
+
constructor(usbDevice, logging) {
|
|
19
|
+
Object.defineProperty(this, "usbDevice", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: usbDevice
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(this, "logging", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: logging
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "adi", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "cortexM", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "serial", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: void 0
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, "initialConnectionComplete", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: false
|
|
54
|
+
});
|
|
55
|
+
const cmsisDap = new CmsisDapUsb(new UsbTransport(this.usbDevice), this.logging);
|
|
56
|
+
this.adi = new ArmDebugSwd(cmsisDap, this.logging);
|
|
57
|
+
this.cortexM = new CortexM(this.adi);
|
|
58
|
+
this.serial = new DapLinkSerial(cmsisDap, this.logging);
|
|
59
|
+
}
|
|
60
|
+
// Drawn from https://github.com/microsoft/pxt-microbit/blob/dec5b8ce72d5c2b4b0b20aafefce7474a6f0c7b2/editor/extension.tsx#L119
|
|
61
|
+
async reconnect() {
|
|
62
|
+
if (this.initialConnectionComplete) {
|
|
63
|
+
await this.disconnect();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.initialConnectionComplete = true;
|
|
67
|
+
}
|
|
68
|
+
await this.adi.connect();
|
|
69
|
+
const boardSerialInfo = await this.readBoardSerialInfo();
|
|
70
|
+
this.logging.log(`Detected board ID ${boardSerialInfo.id}`);
|
|
71
|
+
// https://support.microbit.org/support/solutions/articles/19000067679-how-to-find-the-name-of-your-micro-bit
|
|
72
|
+
// We retry on errors as immediately after flash the micro:bit won't be ready to respond
|
|
73
|
+
const deviceId = await readMem32WithRetry(this.adi, FICR_DEVICE_ID_1, this.logging);
|
|
74
|
+
const pageSize = await readMem32WithRetry(this.adi, FICR_CODEPAGESIZE, this.logging);
|
|
75
|
+
const numPages = await readMem32WithRetry(this.adi, FICR_CODESIZE, this.logging);
|
|
76
|
+
return { boardSerialInfo, deviceId, pageSize, numPages };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Read the board serial info, preferring the DAPLink vendor command.
|
|
80
|
+
* Chrome may anonymize USBDevice.serialNumber for anti-fingerprinting
|
|
81
|
+
* (https://github.com/microbit-foundation/microbit-connection/issues/57)
|
|
82
|
+
* so we read it via the DAP protocol instead.
|
|
83
|
+
*/
|
|
84
|
+
async readBoardSerialInfo() {
|
|
85
|
+
const dapSerial = await readDaplinkUniqueId(this.adi.dap, this.logging);
|
|
86
|
+
if (dapSerial) {
|
|
87
|
+
return BoardSerialInfo.fromSerial(dapSerial, this.logging.log.bind(this.logging));
|
|
88
|
+
}
|
|
89
|
+
this.logging.log("Failed to read unique ID via DAP vendor command, falling back to USB serial number (may be affected by anti-fingerprinting)");
|
|
90
|
+
return BoardSerialInfo.parse(this.usbDevice, this.logging.log.bind(this.logging));
|
|
91
|
+
}
|
|
92
|
+
async disconnect() {
|
|
93
|
+
if (this.usbDevice.opened && this.adi.isOpen) {
|
|
94
|
+
return this.adi.disconnect();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=device-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-wrapper.js","sourceRoot":"","sources":["../../../src/usb/device-wrapper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,oEAAoE;AACpE,gEAAgE;AAChE,MAAM,iBAAiB,GAAG,UAAU,CAAC;AACrC,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,gBAAgB,GAAG,UAAU,CAAC;AASpC,MAAM,OAAO,gBAAgB;I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|
+
* (c) 2021, Micro:bit Educational Foundation and contributors
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
6
|
export declare const read32FromUInt8Array: (data: Uint8Array, i: number) => number;
|
|
7
|
-
export declare const bufferConcat: (bufs: Uint8Array[]) => Uint8Array;
|
|
8
7
|
export declare const murmur3_core: (data: Uint8Array) => [number, number];
|
|
9
|
-
export declare const apReg: (r: number, mode: number) => number;
|
|
10
|
-
export declare const regRequest: (regId: number, isWrite?: boolean) => number;
|
|
11
8
|
export declare class Page {
|
|
12
9
|
readonly targetAddr: number;
|
|
13
10
|
readonly data: Uint8Array;
|
|
14
11
|
constructor(targetAddr: number, data: Uint8Array);
|
|
15
12
|
}
|
|
16
13
|
export declare const pageAlignBlocks: (buffer: Uint8Array, targetAddr: number, pageSize: number) => Page[];
|
|
17
|
-
export declare const onlyChanged: (pages: Page[], checksums:
|
|
14
|
+
export declare const onlyChanged: (pages: Page[], checksums: Uint32Array, pageSize: number) => Page[];
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
import { DapVal } from "./constants.js";
|
|
7
|
-
// Represents the micro:bit's core registers
|
|
8
|
-
// Drawn from https://armmbed.github.io/dapjs/docs/enums/coreregister.html
|
|
9
|
-
export const CoreRegister = {
|
|
10
|
-
SP: 13,
|
|
11
|
-
LR: 14,
|
|
12
|
-
PC: 15,
|
|
13
|
-
};
|
|
14
6
|
export const read32FromUInt8Array = (data, i) => {
|
|
15
7
|
return ((data[i] |
|
|
16
8
|
(data[i + 1] << 8) |
|
|
@@ -18,19 +10,6 @@ export const read32FromUInt8Array = (data, i) => {
|
|
|
18
10
|
(data[i + 3] << 24)) >>>
|
|
19
11
|
0);
|
|
20
12
|
};
|
|
21
|
-
export const bufferConcat = (bufs) => {
|
|
22
|
-
let len = 0;
|
|
23
|
-
for (const b of bufs) {
|
|
24
|
-
len += b.length;
|
|
25
|
-
}
|
|
26
|
-
const r = new Uint8Array(len);
|
|
27
|
-
len = 0;
|
|
28
|
-
for (const b of bufs) {
|
|
29
|
-
r.set(b, len);
|
|
30
|
-
len += b.length;
|
|
31
|
-
}
|
|
32
|
-
return r;
|
|
33
|
-
};
|
|
34
13
|
// Returns the MurmurHash of the data passed to it, used for checksum calculation.
|
|
35
14
|
// Drawn from https://github.com/microsoft/pxt-microbit/blob/dec5b8ce72d5c2b4b0b20aafefce7474a6f0c7b2/editor/extension.tsx#L14
|
|
36
15
|
export const murmur3_core = (data) => {
|
|
@@ -50,25 +29,6 @@ export const murmur3_core = (data) => {
|
|
|
50
29
|
}
|
|
51
30
|
return [h0, h1];
|
|
52
31
|
};
|
|
53
|
-
// Returns a representation of an Access Port Register.
|
|
54
|
-
// Drawn from https://github.com/mmoskal/dapjs/blob/a32f11f54e9e76a9c61896ddd425c1cb1a29c143/src/util.ts#L63
|
|
55
|
-
export const apReg = (r, mode) => {
|
|
56
|
-
const v = r | mode | DapVal.AP_ACC;
|
|
57
|
-
return 4 + ((v & 0x0c) >> 2);
|
|
58
|
-
};
|
|
59
|
-
// Returns a code representing a request to read/write a certain register.
|
|
60
|
-
// Drawn from https://github.com/mmoskal/dapjs/blob/a32f11f54e9e76a9c61896ddd425c1cb1a29c143/src/util.ts#L92
|
|
61
|
-
export const regRequest = (regId, isWrite = false) => {
|
|
62
|
-
let request = !isWrite ? 1 << 1 /* READ */ : 0 << 1; /* WRITE */
|
|
63
|
-
if (regId < 4) {
|
|
64
|
-
request |= 0 << 0 /* DP_ACC */;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
request |= 1 << 0 /* AP_ACC */;
|
|
68
|
-
}
|
|
69
|
-
request |= (regId & 3) << 2;
|
|
70
|
-
return request;
|
|
71
|
-
};
|
|
72
32
|
export class Page {
|
|
73
33
|
constructor(targetAddr, data) {
|
|
74
34
|
Object.defineProperty(this, "targetAddr", {
|
|
@@ -109,14 +69,14 @@ export const pageAlignBlocks = (buffer, targetAddr, pageSize) => {
|
|
|
109
69
|
export const onlyChanged = (pages, checksums, pageSize) => {
|
|
110
70
|
return pages.filter((page) => {
|
|
111
71
|
let idx = page.targetAddr / pageSize;
|
|
112
|
-
if (idx *
|
|
72
|
+
if (idx * 2 + 2 > checksums.length)
|
|
113
73
|
return true; // out of range?
|
|
114
|
-
let c0 =
|
|
115
|
-
let c1 =
|
|
74
|
+
let c0 = checksums[idx * 2];
|
|
75
|
+
let c1 = checksums[idx * 2 + 1];
|
|
116
76
|
let ch = murmur3_core(page.data);
|
|
117
77
|
if (c0 === ch[0] && c1 === ch[1])
|
|
118
78
|
return false;
|
|
119
79
|
return true;
|
|
120
80
|
});
|
|
121
81
|
};
|
|
122
|
-
//# sourceMappingURL=
|
|
82
|
+
//# sourceMappingURL=partial-flashing-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-flashing-utils.js","sourceRoot":"","sources":["../../../src/usb/partial-flashing-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAgB,EAAE,CAAS,EAAU,EAAE;IAC1E,OAAO,CACL,CAAC,IAAI,CAAC,CAAC,CAAC;QACN,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACtB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,kFAAkF;AAClF,8HAA8H;AAC9H,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAgB,EAAoB,EAAE;IACjE,IAAI,EAAE,GAAG,UAAU,CAAC;IACpB,IAAI,EAAE,GAAG,UAAU,CAAC;IAEpB,KAAK,IAAI,CAAC,GAAG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AAS,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAChC,IAAI,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -37,20 +37,28 @@
|
|
|
37
37
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
38
38
|
* SOFTWARE.
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Implementation of partial flashing for the micro:bit.
|
|
42
|
+
*
|
|
43
|
+
* Latest Microsoft implementation is here:
|
|
44
|
+
* https://github.com/microsoft/pxt-microbit/blob/master/editor/flash.ts
|
|
45
|
+
*/
|
|
46
|
+
import { Logging } from "../logging.js";
|
|
47
|
+
import { BoardVersion, ProgressCallback } from "../device.js";
|
|
43
48
|
import MemoryMap from "nrf-intel-hex";
|
|
49
|
+
import { USBDeviceWrapper } from "./device-wrapper.js";
|
|
44
50
|
/**
|
|
45
|
-
* Uses a
|
|
51
|
+
* Uses a USBDeviceWrapper to flash the micro:bit.
|
|
46
52
|
*
|
|
47
|
-
*
|
|
53
|
+
* Intended to be used for a single flash with a pre-connected USBDeviceWrapper.
|
|
48
54
|
*/
|
|
49
55
|
export declare class PartialFlashing {
|
|
50
|
-
private
|
|
56
|
+
private device;
|
|
51
57
|
private logging;
|
|
52
58
|
private boardVersion;
|
|
53
|
-
|
|
59
|
+
private pageSize;
|
|
60
|
+
private numPages;
|
|
61
|
+
constructor(device: USBDeviceWrapper, logging: Logging, boardVersion: BoardVersion, pageSize: number, numPages: number);
|
|
54
62
|
private log;
|
|
55
63
|
private getFlashChecksumsAsync;
|
|
56
64
|
private runFlash;
|
|
@@ -60,8 +68,26 @@ export declare class PartialFlashing {
|
|
|
60
68
|
fullFlashAsync(data: string | Uint8Array | MemoryMap, updateProgress: ProgressCallback): Promise<void>;
|
|
61
69
|
flashAsync(data: string | Uint8Array | MemoryMap, updateProgress: ProgressCallback): Promise<boolean>;
|
|
62
70
|
private convertDataToHexString;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
private
|
|
71
|
+
/**
|
|
72
|
+
* Parse the flash data into a MemoryMap (if not already one).
|
|
73
|
+
*/
|
|
74
|
+
private toMemoryMap;
|
|
75
|
+
/**
|
|
76
|
+
* Extract padded flash bytes (main flash only) and UICR entries from a
|
|
77
|
+
* MemoryMap. Parses the data once for both.
|
|
78
|
+
*/
|
|
79
|
+
private extractFlashAndUicr;
|
|
80
|
+
/**
|
|
81
|
+
* Check UICR and repair if needed after a partial flash.
|
|
82
|
+
*
|
|
83
|
+
* UICR bits can only be cleared (1→0) without erasing. If all mismatched
|
|
84
|
+
* bits only need 1→0, we can write directly on both V1 and V2.
|
|
85
|
+
* If any bit needs 0→1, an erase is required first:
|
|
86
|
+
* - V2: erase via NVMC.ERASEUICR, then write
|
|
87
|
+
* - V1: no independent UICR erase, fall back to full flash
|
|
88
|
+
*
|
|
89
|
+
* Returns true if we stayed on the partial flash path, false if we had
|
|
90
|
+
* to fall back to full flash.
|
|
91
|
+
*/
|
|
92
|
+
private ensureUicr;
|
|
67
93
|
}
|