mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-20 04:54:45 -07:00
Merge remote-tracking branch 'ofw/dev' into mntm-dev
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
* @brief Checks compatibility between the script and the JS SDK that the
|
||||
* firmware provides
|
||||
*
|
||||
* @note You're looking at JS SDK v0.1
|
||||
* @note You're looking at JS SDK v0.3
|
||||
*
|
||||
* @param expectedMajor JS SDK major version expected by the script
|
||||
* @param expectedMinor JS SDK minor version expected by the script
|
||||
@@ -92,7 +92,7 @@ declare function sdkCompatibilityStatus(expectedMajor: number, expectedMinor: nu
|
||||
* @brief Checks compatibility between the script and the JS SDK that the
|
||||
* firmware provides in a boolean fashion
|
||||
*
|
||||
* @note You're looking at JS SDK v0.1
|
||||
* @note You're looking at JS SDK v0.3
|
||||
*
|
||||
* @param expectedMajor JS SDK major version expected by the script
|
||||
* @param expectedMinor JS SDK minor version expected by the script
|
||||
@@ -105,7 +105,7 @@ declare function isSdkCompatible(expectedMajor: number, expectedMinor: number):
|
||||
* @brief Asks the user whether to continue executing the script if the versions
|
||||
* are not compatible. Does nothing if they are.
|
||||
*
|
||||
* @note You're looking at JS SDK v0.1
|
||||
* @note You're looking at JS SDK v0.3
|
||||
*
|
||||
* @param expectedMajor JS SDK major version expected by the script
|
||||
* @param expectedMinor JS SDK minor version expected by the script
|
||||
|
||||
@@ -9,3 +9,10 @@ export type IconData = symbol & { "__tag__": "icon" };
|
||||
* @version Added in JS SDK 0.2, extra feature `"gui-widget"`
|
||||
*/
|
||||
export declare function getBuiltin(icon: BuiltinIcon): IconData;
|
||||
|
||||
/**
|
||||
* Loads a .fxbm icon (XBM Flipper sprite, from flipperzero-game-engine) for use in GUI
|
||||
* @param path Path to the .fxbm file
|
||||
* @version Added in JS SDK 0.3, extra feature `"gui-widget-extras"`
|
||||
*/
|
||||
export declare function loadFxbm(path: string): IconData;
|
||||
|
||||
@@ -42,7 +42,9 @@ type TextBoxElement = { element: "text_box", stripToDots: boolean } & Position &
|
||||
type TextScrollElement = { element: "text_scroll" } & Position & Size & Text;
|
||||
type ButtonElement = { element: "button", button: "left" | "center" | "right" } & Text;
|
||||
type IconElement = { element: "icon", iconData: IconData } & Position;
|
||||
type FrameElement = { element: "frame", radius: number } & Position & Size;
|
||||
type RectElement = { element: "rect", radius: number, fill: boolean } & Position & Size; /** @version Amended in JS SDK 0.3, extra feature `"gui-widget-extras"` */
|
||||
type CircleElement = { element: "circle", radius: number, fill: boolean } & Position; /** @version Added in JS SDK 0.3, extra feature `"gui-widget-extras"` */
|
||||
type LineElement = { element: "line", x1: number, y1: number, x2: number, y2: number }; /** @version Added in JS SDK 0.3, extra feature `"gui-widget-extras"` */
|
||||
|
||||
type Element = StringMultilineElement
|
||||
| StringElement
|
||||
@@ -50,7 +52,9 @@ type Element = StringMultilineElement
|
||||
| TextScrollElement
|
||||
| ButtonElement
|
||||
| IconElement
|
||||
| FrameElement;
|
||||
| RectElement
|
||||
| CircleElement
|
||||
| LineElement;
|
||||
|
||||
type Props = {};
|
||||
type Child = Element;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@next-flip/fz-sdk-mntm",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "Type declarations and documentation for native JS modules available on Momentum Custom Firmware for Flipper Zero",
|
||||
"keywords": [
|
||||
"momentum",
|
||||
|
||||
@@ -4,16 +4,33 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
export interface Framing {
|
||||
/**
|
||||
* @note 6 data bits can only be selected when parity is enabled (even or
|
||||
* odd)
|
||||
* @note 9 data bits can only be selected when parity is disabled (none)
|
||||
*/
|
||||
dataBits: "6" | "7" | "8" | "9";
|
||||
parity: "none" | "even" | "odd";
|
||||
/**
|
||||
* @note LPUART only supports whole stop bit lengths (i.e. 1 and 2 but not
|
||||
* 0.5 and 1.5)
|
||||
*/
|
||||
stopBits: "0.5" | "1" | "1.5" | "2";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the serial port
|
||||
*
|
||||
* Automatically disables Expansion module service to prevent interference.
|
||||
*
|
||||
* @param port The port to initialize (`"lpuart"` or `"start"`)
|
||||
* @param baudRate
|
||||
* @param port The port to initialize (`"lpuart"` or `"usart"`)
|
||||
* @param baudRate Baud rate
|
||||
* @param framing See `Framing` type
|
||||
* @version Added in JS SDK 0.1
|
||||
* @version Added `framing` parameter in JS SDK 0.3, extra feature `"serial-framing"`
|
||||
*/
|
||||
export declare function setup(port: "lpuart" | "usart", baudRate: number): void;
|
||||
export declare function setup(port: "lpuart" | "usart", baudRate: number, framing?: Framing): void;
|
||||
|
||||
/**
|
||||
* @brief Writes data to the serial port
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/**
|
||||
* 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;
|
||||
Reference in New Issue
Block a user