8#include <furi_hal_serial.h>
9#include <furi_hal_serial_control.h>
11#define INTERCOM_TX_TIMEOUT_MS (1000UL)
14#define INTERCOM_LOG_D(...) FURI_LOG_D(TAG, __VA_ARGS__)
16#define INTERCOM_LOG_D(...)
19#ifndef INTERCOM_BAUD_RATE
20#define INTERCOM_BAUD_RATE (11250000UL)
23#if defined(BSB_MCU_U5)
24#define INTERCOM_SERIAL FuriHalSerialIdUsart1
25#elif defined(BSB_MCU_SI917)
26#define INTERCOM_SERIAL FuriHalSerialIdUsart0
28#error "Unsupported MCU"
32 IntercomCustomEventStatusChanged = 1UL << 0,
33 IntercomCustomEventFrameSent = 1UL << 1,
34 IntercomCustomEventDataAvailable = 1UL << 2,
41 void* rx_callback_context;
45 FuriEventLoop* event_loop;
46 FuriSemaphore* tx_semaphore;
47 FuriEventLoopTimer* tx_timer;
59size_t intercom_tx_internal(
64 uint32_t timeout_ticks);
68void intercom_start_rx_thread(
Intercom* instance);
78void intercom_channel_set_callback(
85bool intercom_channel_wait_until_ready(
IntercomChannel* channel, uint32_t timeout);
93void intercom_start_heartbeat_thread(
Intercom* instance);
99void intercom_meta_send_heartbeat(
Intercom* instance);
105size_t intercom_build_frame(
113void intercom_reset_other_side(
void);
Chip-to-chip intercommunication via U(S)ART service.
IntercomChannelId
Enumeration of available channel identifiers.
Definition intercom.h:41
@ IntercomChannelIdMax
Special value for internal use.
Definition intercom.h:54
IntercomStatus
Enumeration of possible Intercom statuses.
Definition intercom.h:30
void(* IntercomRxCallback)(const void *data, size_t data_size, void *context)
Receive callback function type.
Definition intercom.h:94
Frame definitions and parsing for the Intercom service.
Frame header with fields which help control frame exchange.
Definition ble_intercom_types.h:40
Definition f21/furi_hal/furi_hal_serial_types_i.h:7
Definition intercom_i.h:37
Definition intercom_i.h:44