Loading...
Searching...
No Matches
furi_hal_serial.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include "furi_hal_serial_types.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
24void furi_hal_serial_init(FuriHalSerialHandle* handle, uint32_t baud);
25
34
42
50
59
65void furi_hal_serial_set_br(FuriHalSerialHandle* handle, uint32_t baud);
66
79void furi_hal_serial_tx(FuriHalSerialHandle* handle, const uint8_t* buffer, size_t buffer_size);
80
88
97
107 FuriHalSerialHandle* handle,
109 void* context);
110
122 FuriHalSerialHandle* handle,
124 void* context,
125 bool report_errors);
126
132
142
153
154/* DMA based Serial API */
155
156#define FURI_HAL_SERIAL_DMA_BUFFER_SIZE (256u)
157
169 FuriHalSerialHandle* handle,
171 size_t data_len,
172 void* context);
173
184 FuriHalSerialHandle* handle,
185 FuriHalSerialDirection direction);
186
197 FuriHalSerialHandle* handle,
198 FuriHalSerialDirection direction);
199
207const GpioPin*
208 furi_hal_serial_get_gpio_pin(FuriHalSerialHandle* handle, FuriHalSerialDirection direction);
209
218 FuriHalSerialHandle* handle,
220 void* context,
221 bool report_errors);
222
228
240size_t furi_hal_serial_dma_rx(FuriHalSerialHandle* handle, uint8_t* data, size_t len);
241
242#ifdef __cplusplus
243}
244#endif
void furi_hal_serial_async_rx_start(FuriHalSerialHandle *handle, FuriHalSerialAsyncRxCallback callback, void *context, bool report_errors)
Start and sets Serial Receive callback.
Definition furi_hal_serial.c:766
void furi_hal_serial_dma_rx_start(FuriHalSerialHandle *handle, FuriHalSerialDmaRxCallback callback, void *context, bool report_errors)
Start and sets Serial event callback receive DMA.
Definition furi_hal_serial.c:890
void furi_hal_serial_disable_direction(FuriHalSerialHandle *handle, FuriHalSerialDirection direction)
Disable an input/output directon.
Definition furi_hal_serial.c:930
void(* FuriHalSerialDmaRxCallback)(FuriHalSerialHandle *handle, FuriHalSerialRxEvent event, size_t data_len, void *context)
Receive DMA callback.
Definition furi_hal_serial.h:168
size_t furi_hal_serial_dma_rx(FuriHalSerialHandle *handle, uint8_t *data, size_t len)
Get data Serial receive DMA.
Definition furi_hal_serial.c:843
void furi_hal_serial_enable_direction(FuriHalSerialHandle *handle, FuriHalSerialDirection direction)
Enable an input/output directon.
Definition furi_hal_serial.c:913
FuriHalSerialRxEvent
Serial RX events.
Definition furi_hal_serial.h:90
@ FuriHalSerialRxEventNoiseError
Noise Error: noise on the line detected.
Definition furi_hal_serial.h:94
@ FuriHalSerialRxEventOverrunError
Overrun Error: no space for received data.
Definition furi_hal_serial.h:95
@ FuriHalSerialRxEventData
Data: new data available.
Definition furi_hal_serial.h:91
@ FuriHalSerialRxEventIdle
Idle: bus idle detected.
Definition furi_hal_serial.h:92
@ FuriHalSerialRxEventFrameError
Framing Error: incorrect frame detected.
Definition furi_hal_serial.h:93
bool furi_hal_serial_async_rx_available(FuriHalSerialHandle *handle)
Check if there is data available for reading.
Definition furi_hal_serial.c:789
void furi_hal_serial_resume(FuriHalSerialHandle *handle)
Resume operation.
Definition furi_hal_serial.c:647
uint8_t furi_hal_serial_async_rx(FuriHalSerialHandle *handle)
Get data Serial receive.
Definition furi_hal_serial.c:800
void furi_hal_serial_deinit(FuriHalSerialHandle *handle)
De-initialize Serial.
Definition furi_hal_serial.c:608
void furi_hal_serial_dma_rx_stop(FuriHalSerialHandle *handle)
Stop Serial receive DMA.
Definition furi_hal_serial.c:907
void furi_hal_serial_set_br(FuriHalSerialHandle *handle, uint32_t baud)
Changes baud rate.
Definition furi_hal_serial.c:579
bool furi_hal_serial_is_baud_rate_supported(FuriHalSerialHandle *handle, uint32_t baud)
Determine whether a certain baud rate is supported.
Definition furi_hal_serial.c:507
void furi_hal_serial_tx_wait_complete(FuriHalSerialHandle *handle)
Wait until transmission is completed.
Definition furi_hal_serial.c:689
void furi_hal_serial_suspend(FuriHalSerialHandle *handle)
Suspend operation.
Definition furi_hal_serial.c:637
const GpioPin * furi_hal_serial_get_gpio_pin(FuriHalSerialHandle *handle, FuriHalSerialDirection direction)
Get the GPIO pin associated with a serial.
Definition furi_hal_serial.c:946
void furi_hal_serial_tx(FuriHalSerialHandle *handle, const uint8_t *buffer, size_t buffer_size)
Transmits data in semi-blocking mode.
Definition furi_hal_serial.c:659
void(* FuriHalSerialAsyncRxCallback)(FuriHalSerialHandle *handle, FuriHalSerialRxEvent event, void *context)
Receive callback.
Definition furi_hal_serial.h:106
void furi_hal_serial_init(FuriHalSerialHandle *handle, uint32_t baud)
Initialize Serial.
Definition furi_hal_serial.c:498
void furi_hal_serial_async_rx_stop(FuriHalSerialHandle *handle)
Stop Serial Receive.
Definition furi_hal_serial.c:783
Definition furi_hal_serial_types_i.h:5
Gpio structure.
Definition furi_hal_gpio.h:161