-
-
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.
JS: Add typedocs for all extra modules
- Loading branch information
Showing
6 changed files
with
310 additions
and
1 deletion.
There are no files selected for viewing
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
41 changes: 41 additions & 0 deletions
41
applications/system/js_app/packages/fz-sdk/blebeacon/index.d.ts
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Module for using the BLE extra beacon | ||
* @version Available with JS feature `blebeacon` | ||
* @module | ||
*/ | ||
|
||
/** | ||
* @brief Check if the BLE beacon is active | ||
*/ | ||
export declare function isActive(): boolean; | ||
|
||
/** | ||
* @brief Set BLE beacon configuration | ||
* @param mac The MAC address to use | ||
* @param power The power level to use, in GapAdvPowerLevel scale: 0x00 (-40dBm) to 0x1F (+6dBm) | ||
* @param minInterval Minimum advertisement interval | ||
* @param maxInterval Maximum advertisement interval | ||
*/ | ||
export declare function setConfig(mac: Uint8Array, power?: number, minInterval?: number, maxInterval?: number): void; | ||
|
||
/** | ||
* @brief Set BLE beacon advertisement data | ||
* @param data The advertisement data to use | ||
*/ | ||
export declare function setData(data: Uint8Array): void; | ||
|
||
/** | ||
* @brief Start BLE beacon | ||
*/ | ||
export declare function start(): void; | ||
|
||
/** | ||
* @brief Stop BLE beacon | ||
*/ | ||
export declare function stop(): void; | ||
|
||
/** | ||
* @brief Set whether the BLE beacon will remain active after the script exits | ||
* @param keep True if BLE beacon should remain active after script exit | ||
*/ | ||
export declare function keepAlive(keep: boolean): void; |
64 changes: 64 additions & 0 deletions
64
applications/system/js_app/packages/fz-sdk/subghz/index.d.ts
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Module for using Sub-GHz transciever | ||
* @version Available with JS feature `subghz` | ||
* @module | ||
*/ | ||
|
||
/** | ||
* @brief Initialize Sub-GHz module | ||
*/ | ||
export declare function setup(): void; | ||
|
||
/** | ||
* @brief Deinitialize Sub-GHz module | ||
*/ | ||
export declare function end(): void; | ||
|
||
/** | ||
* @brief Set radio to receive mode | ||
*/ | ||
export declare function setRx(): void; | ||
|
||
/** | ||
* @brief Set radio to idle mode | ||
*/ | ||
export declare function setIdle(): void; | ||
|
||
/** | ||
* @brief Return current RSSI on current frequency, or undefined if radio is not in receive mode | ||
*/ | ||
export declare function getRssi(): number | undefined; | ||
|
||
type RadioState = "RX" | "TX" | "IDLE" | ""; | ||
|
||
/** | ||
* @brief Get current radio mode/state | ||
*/ | ||
export declare function getState(): RadioState; | ||
|
||
/** | ||
* @brief Get currently selected frequency | ||
*/ | ||
export declare function getFrequency(): number; | ||
|
||
/** | ||
* @brief Change current frequency, radio must be in idle mode | ||
* | ||
* Returns the effective frequency, since radio module cant use all precise | ||
* values and instead chooses closest one available | ||
* | ||
* @param frequency What frequency to use | ||
*/ | ||
export declare function setFrequency(frequency: number): number; | ||
|
||
/** | ||
* @brief Check whether the radio module in use is internal or external | ||
*/ | ||
export declare function isExternal(): boolean; | ||
|
||
/** | ||
* @brief Transmit a .sub file, return true on success or error on failure | ||
* @param path What .sub file to transmit | ||
* @param repeat How many times to repeat the signal | ||
*/ | ||
export declare function transmitFile(path: string, repeat?: number): true; |
32 changes: 32 additions & 0 deletions
32
applications/system/js_app/packages/fz-sdk/usbdisk/index.d.ts
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Module for USB mass storage emulation | ||
* @version Available with JS feature `usbdisk` | ||
* @module | ||
*/ | ||
|
||
/** | ||
* @brief Create a disk image and format it as FatFs, error on failure | ||
* @param path Where to create the disk image | ||
* @param size How big the disk image should be | ||
* @version Available with JS feature `usbdisk-createimage` | ||
*/ | ||
export declare function createImage(path: string, size: number): void; | ||
|
||
/** | ||
* @brief Start emulating mass storage device | ||
* @param path The disk image to emulate | ||
*/ | ||
export declare function start(path: string): void; | ||
|
||
/** | ||
* @brief Stop emulating mass storage device | ||
*/ | ||
export declare function stop(): void; | ||
|
||
/** | ||
* @brief Check if the mass storage device was exected | ||
* | ||
* Useful as a loop condition with a delay, so UsbDisk keeps running until ejected | ||
* | ||
*/ | ||
export declare function wasEjected(): boolean; |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Module for interactive with Flipper Video Game Module (VGM) | ||
* @version Available with JS feature `vgm` | ||
* @module | ||
*/ | ||
|
||
/** | ||
* @brief Get current VGM pitch, or undefined if VGM not present | ||
*/ | ||
export declare function getPitch(): number | undefined; | ||
|
||
/** | ||
* @brief Get current VGM roll, or undefined if VGM not present | ||
*/ | ||
export declare function getRoll(): number | undefined; | ||
|
||
/** | ||
* @brief Get current VGM yaw, or undefined if VGM not present | ||
*/ | ||
export declare function getYaw(): number | undefined; | ||
|
||
/** | ||
* @brief Wait until yaw changed by specified amount | ||
* | ||
* Returns how much the yaw changed from initial value if it exceeded the | ||
* specified yaw angle, or returns 0 if it was not exceeded within the timeout | ||
* Or returns undefined if VGM is not present | ||
* | ||
* @param angle How much the yaw needs to change | ||
* @param timeout Maximum time in milliseconds to wait for specified yaw change, default 3000ms | ||
*/ | ||
export declare function deltaYaw(angle: number, timeout?: number): number | undefined; |
140 changes: 140 additions & 0 deletions
140
applications/system/js_app/packages/fz-sdk/widget/index.d.ts
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 |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/** | ||
* Displays a customizable Widget on screen | ||
* @version Available with JS feature `widget` | ||
* @module | ||
*/ | ||
|
||
type ComponentId = number; | ||
|
||
/** | ||
* @brief Add a box component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param w Width | ||
* @param h Height | ||
*/ | ||
export declare function addBox(x: number, y: number, w: number, h: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a circle component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param r Radius | ||
*/ | ||
export declare function addCircle(x: number, y: number, r: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a disc component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param r Radius | ||
*/ | ||
export declare function addDisc(x: number, y: number, r: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a dot component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
*/ | ||
export declare function addDot(x: number, y: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a frame component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param w Width | ||
* @param h Height | ||
*/ | ||
export declare function addFrame(x: number, y: number, w: number, h: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a glyph component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param ch ASCII character code (eg. `"C".charCodeAt(0)`) | ||
*/ | ||
export declare function addGlyph(x: number, y: number, ch: number): ComponentId; | ||
|
||
/** | ||
* @brief Add an icon component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param icon Name of the icon (eg. `"ButtonUp_7x4"`) | ||
* @version Available with JS feature `widget-addicon` | ||
*/ | ||
export declare function addIcon(x: number, y: number, icon: string): ComponentId; | ||
|
||
/** | ||
* @brief Add a line component | ||
* @param x1 Horizontal position 1 | ||
* @param y1 Vertical position 1 | ||
* @param x2 Horizontal position 2 | ||
* @param y2 Vertical position 2 | ||
*/ | ||
export declare function addLine(x1: number, y1: number, x2: number, y2: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a rounded box component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param w Width | ||
* @param h Height | ||
* @param r Radius | ||
*/ | ||
export declare function addRbox(x: number, y: number, w: number, h: number, r: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a rounded frame component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param w Width | ||
* @param h Height | ||
* @param r Radius | ||
*/ | ||
export declare function addRframe(x: number, y: number, w: number, h: number, r: number): ComponentId; | ||
|
||
/** | ||
* @brief Add a text component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param font What font to use, Primary or Secondary | ||
* @param text Text to display | ||
*/ | ||
export declare function addText(x: number, y: number, font: "Primary" | "Secondary", text: string): ComponentId; | ||
|
||
type XbmId = number; | ||
|
||
/** | ||
* @brief Add an xbm image component | ||
* @param x Horizontal position | ||
* @param y Vertical position | ||
* @param index Loaded xbm id to use | ||
*/ | ||
export declare function addXbm(x: number, y: number, index: XbmId): ComponentId; | ||
|
||
/** | ||
* @brief Load an xbm image sprite | ||
* @param path Xbm file to load | ||
*/ | ||
export declare function loadImageXbm(path: string): XbmId; | ||
|
||
/** | ||
* @brief Remove a component | ||
* @param id Component id to remove | ||
*/ | ||
export declare function remove(id: ComponentId): boolean; | ||
|
||
/** | ||
* @brief Check if the widget view is shown | ||
*/ | ||
export declare function isOpen(): boolean; | ||
|
||
/** | ||
* @brief Show the widget view | ||
*/ | ||
export declare function show(): void; | ||
|
||
/** | ||
* @brief Close the widget view | ||
*/ | ||
export declare function close(): void; |