[FL-3734] UART framing mode selection (#4121)

* HAL: feat: uart framing
* JS: feat: uart framing
* fix formatting
* fix pvs warning
* HAL: flash impact reduction attempt 1
* HAL: flash impact reduction attempt 2
* fix compile error
* HAL: finalize flash impact reduction
* HAL: remove user-facing magic numbers

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Anna Antonenko
2025-02-20 23:54:38 +04:00
committed by GitHub
parent 290a6dc1eb
commit 7c5c5d4749
15 changed files with 404 additions and 108 deletions

View File

@@ -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

View File

@@ -1,6 +1,6 @@
{
"name": "@flipperdevices/fz-sdk",
"version": "0.2.0",
"version": "0.3.0",
"description": "Type declarations and documentation for native JS modules available on Flipper Zero",
"keywords": [
"flipper",

View File

@@ -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