33 *
44 * SPDX-License-Identifier: MIT
55 */
6+ import { AccelerometerData } from "./accelerometer.js" ;
67import { TypedEventTarget } from "./events.js" ;
8+ import { LedMatrix } from "./led.js" ;
9+ import { MagnetometerData } from "./magnetometer.js" ;
710import { UARTDataEvent } from "./uart.js" ;
811
912/**
@@ -239,12 +242,17 @@ export interface DeviceConnection
239242
240243export interface DeviceWebUSBConnection extends DeviceConnection {
241244 /**
242- * Get the deviceId.
245+ * Gets micro:bit deviceId.
243246 *
244247 * @returns the device id or undefined if there is no connection.
245248 */
246249 getDeviceId ( ) : number | undefined ;
247250
251+ /**
252+ * Sets device request exclusion filters.
253+ */
254+ setRequestDeviceExclusionFilters ( exclusionFilters : USBDeviceFilter [ ] ) : void ;
255+
248256 /**
249257 * Flash the micro:bit.
250258 *
@@ -254,11 +262,16 @@ export interface DeviceWebUSBConnection extends DeviceConnection {
254262 flash ( dataSource : FlashDataSource , options : { } ) : Promise < void > ;
255263
256264 /**
257- * Get the device.
265+ * Gets micro:bit device.
258266 *
259267 * @returns the USB device or undefined if there is no connection.
260268 */
261269 getDevice ( ) : USBDevice | undefined ;
270+
271+ /**
272+ * Resets the micro:bit in software.
273+ */
274+ softwareReset ( ) : Promise < void > ;
262275}
263276
264277export interface DeviceWebBluetoothConnection extends DeviceConnection {
@@ -268,6 +281,102 @@ export interface DeviceWebBluetoothConnection extends DeviceConnection {
268281 * @param name The name of the micro:bit.
269282 */
270283 setNameFilter ( name : string ) : void ;
284+
285+ /**
286+ * Gets micro:bit accelerometer data.
287+ *
288+ * @returns accelerometer data or undefined if there is no connection.
289+ */
290+ getAccelerometerData ( ) : Promise < AccelerometerData | undefined > ;
291+
292+ /**
293+ * Gets micro:bit accelerometer period.
294+ *
295+ * @returns accelerometer period or undefined if there is no connection.
296+ */
297+ getAccelerometerPeriod ( ) : Promise < number | undefined > ;
298+
299+ /**
300+ * Sets micro:bit accelerometer period.
301+ *
302+ * @param value The accelerometer period.
303+ */
304+ setAccelerometerPeriod ( value : number ) : Promise < void > ;
305+
306+ /**
307+ * Sets micro:bit LED text.
308+ *
309+ * @param text The text displayed on micro:bit LED.
310+ */
311+ setLedText ( text : string ) : Promise < void > ;
312+
313+ /**
314+ * Gets micro:bit LED scrolling delay.
315+ *
316+ * @returns LED scrolling delay in milliseconds.
317+ */
318+ getLedScrollingDelay ( ) : Promise < number | undefined > ;
319+
320+ /**
321+ * Sets micro:bit LED scrolling delay.
322+ *
323+ * @param delayInMillis LED scrolling delay in milliseconds.
324+ */
325+ setLedScrollingDelay ( delayInMillis : number ) : Promise < void > ;
326+
327+ /**
328+ * Gets micro:bit LED matrix.
329+ *
330+ * @returns a boolean matrix representing the micro:bit LED display.
331+ */
332+ getLedMatrix ( ) : Promise < LedMatrix | undefined > ;
333+
334+ /**
335+ * Sets micro:bit LED matrix.
336+ *
337+ * @param matrix an boolean matrix representing the micro:bit LED display.
338+ */
339+ setLedMatrix ( matrix : LedMatrix ) : Promise < void > ;
340+
341+ /**
342+ * Gets micro:bit magnetometer data.
343+ *
344+ * @returns magnetometer data.
345+ */
346+ getMagnetometerData ( ) : Promise < MagnetometerData | undefined > ;
347+
348+ /**
349+ * Gets micro:bit magnetometer bearing.
350+ *
351+ * @returns magnetometer bearing.
352+ */
353+ getMagnetometerBearing ( ) : Promise < number | undefined > ;
354+
355+ /**
356+ * Gets micro:bit magnetometer period.
357+ *
358+ * @returns magnetometer period.
359+ */
360+ getMagnetometerPeriod ( ) : Promise < number | undefined > ;
361+
362+ /**
363+ * Sets micro:bit magnetometer period.
364+ *
365+ * @param value magnetometer period.
366+ */
367+ setMagnetometerPeriod ( value : number ) : Promise < void > ;
368+
369+ /**
370+ * Triggers micro:bit magnetometer calibration.
371+ */
372+ triggerMagnetometerCalibration ( ) : Promise < void > ;
373+
374+ /**
375+ * Write UART messages.
376+ *
377+ * @param data UART message.
378+ */
379+ writeUART ( data : Uint8Array ) : Promise < void > ;
271380}
272381
273382export interface DeviceRadioBridgeConnection extends DeviceConnection {
0 commit comments