[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

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