unleashed-firmware/targets/f7/furi_hal/furi_hal_uart.h
hedger 917410a0a8
[FL-3629] fbt: reworked assets & resources handling (#3160)
* fbt: reworking targets & assets handling WIP
* fbt: dist fixes
* fbt: moved SD card resources to owning apps
* unit_tests: moved resources to app folder
* github: updated unit_tests paths
* github: packaging fixes
* unit_tests: fixes
* fbt: assets: internal cleanup
* fbt: reworked assets handling
* github: unit_tests: reintroducing fixes
* minor cleanup
* fbt: naming changes to reflect private nature of scons tools
* fbt: resources: fixed dist archive paths
* docs: updated paths
* docs: updated more paths
* docs: included "resources" parameter in app manifest docs; updated assets readme
* updated gitignore for assets
* github: updated action versions
* unit_tests: restored timeout; scripts: assets: logging changes
* gh: don't upload desktop animations for unit test run

Co-authored-by: あく <alleteam@gmail.com>
2023-10-31 00:17:30 +09:00

89 lines
1.8 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file furi_hal_uart.h
* @version 1.0
* @date 2021-11-19
*
* UART HAL api interface
*/
#pragma once
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* UART channels
*/
typedef enum {
FuriHalUartIdUSART1,
FuriHalUartIdLPUART1,
} FuriHalUartId;
/**
* UART events
*/
typedef enum {
UartIrqEventRXNE,
} UartIrqEvent;
/**
* Init UART
* Configures GPIO to UART function, сonfigures UART hardware, enables UART hardware
* @param channel UART channel
* @param baud baudrate
*/
void furi_hal_uart_init(FuriHalUartId channel, uint32_t baud);
/**
* Deinit UART
* Configures GPIO to analog, clears callback and callback context, disables UART hardware
* @param channel UART channel
*/
void furi_hal_uart_deinit(FuriHalUartId channel);
/**
* Suspend UART operation
* Disables UART hardware, settings and callbacks are preserved
* @param channel UART channel
*/
void furi_hal_uart_suspend(FuriHalUartId channel);
/**
* Resume UART operation
* Resumes UART hardware from suspended state
* @param channel UART channel
*/
void furi_hal_uart_resume(FuriHalUartId channel);
/**
* Changes UART baudrate
* @param channel UART channel
* @param baud baudrate
*/
void furi_hal_uart_set_br(FuriHalUartId channel, uint32_t baud);
/**
* Transmits data
* @param channel UART channel
* @param buffer data
* @param buffer_size data size (in bytes)
*/
void furi_hal_uart_tx(FuriHalUartId channel, uint8_t* buffer, size_t buffer_size);
/**
* Sets UART event callback
* @param channel UART channel
* @param callback callback pointer
* @param context callback context
*/
void furi_hal_uart_set_irq_cb(
FuriHalUartId channel,
void (*callback)(UartIrqEvent event, uint8_t data, void* context),
void* context);
#ifdef __cplusplus
}
#endif