![]() |
BSB Developer Docs
|
Chip-to-chip intercommunication via U(S)ART service. More...
#include <furi.h>#include <stddef.h>#include <stdint.h>#include <stdbool.h>Go to the source code of this file.
Macros | |
| #define | RECORD_INTERCOM "intercom" |
| Intercom FURI record identifier. | |
Typedefs | |
| typedef struct Intercom | Intercom |
| Opaque Intercom type declaration. | |
| typedef struct IntercomChannel | IntercomChannel |
| Opaque channel handle. | |
| typedef void(* | IntercomRxCallback) (const void *data, size_t data_size, void *context) |
| Receive callback function type. | |
Enumerations | |
| enum | IntercomStatus { IntercomStatusOk , IntercomStatusUnknown , IntercomStatusErrorSync , IntercomStatusErrorFraming , IntercomStatusErrorTimeout } |
| Enumeration of possible Intercom statuses. More... | |
| enum | IntercomChannelId { IntercomChannelIdInput , IntercomChannelIdWifiControl , IntercomChannelIdWifiData , IntercomChannelIdStatusLights , IntercomChannelIdCli , IntercomChannelIdBle , IntercomChannelIdCryptoBackup , IntercomChannelIdTlsCrypto , IntercomChannelIdMatter , IntercomChannelIdSlInfo , IntercomChannelIdDebug , IntercomChannelIdMax } |
| Enumeration of available channel identifiers. More... | |
Functions | |
| const char * | intercom_get_version_string (void) |
| Get the intercom version string. | |
| FuriState * | intercom_get_state (const Intercom *instance) |
| Get the state object that supports change notifications. | |
| IntercomChannel * | intercom_channel_open (Intercom *instance, IntercomChannelId channel_id, IntercomRxCallback rx_callback, void *context) |
| Open an Intercom channel. | |
| size_t | intercom_tx (IntercomChannel *channel, const void *data, size_t data_size, uint32_t timeout) |
| Transmit data through Intercom. | |
Chip-to-chip intercommunication via U(S)ART service.
| typedef void(* IntercomRxCallback) (const void *data, size_t data_size, void *context) |
Receive callback function type.
| [in] | data | Pointer to the received data |
| [in] | data_size | Number of bytes received |
| [in,out] | context | Pointer to a user-specified context object |
| enum IntercomChannelId |
Enumeration of available channel identifiers.
| enum IntercomStatus |
Enumeration of possible Intercom statuses.
| IntercomChannel * intercom_channel_open | ( | Intercom * | instance, |
| IntercomChannelId | channel_id, | ||
| IntercomRxCallback | rx_callback, | ||
| void * | context ) |
Open an Intercom channel.
Signals to the other chip that you are ready to accept messages on the specified channel.
You may pass NULL as rx_callback, meaning you don't expect any data to arrive from the other side. If the other side does end up sending data to you, the system will crash with a clear message.
Blocks until the Intercom status becomes IntercomStatusOk.
| [in] | instance | Intercom instance |
| [in] | channel_id | Channel identifier from IntercomChannelId |
| [in] | rx_callback | Data reception callback. May be NULL. |
| [in] | context | Context for provided callback. May be NULL. |
| FuriState * intercom_get_state | ( | const Intercom * | instance | ) |
Get the state object that supports change notifications.
The received FuriState object will have an underlying type of IntercomStatus. Use furi_state_subscribe() to get notifications about changes in the current state.
This function never blocks.
| [in,out] | instance | pointer to the Intercom instance |
| const char * intercom_get_version_string | ( | void | ) |
Get the intercom version string.
Returns the version string used for the chip-to-chip handshake. By default this is the firmware git hash; if INTERCOM_FORCE_VERSION is defined at build time, it is that value; if INTERCOM_DISABLE_VERSION_CHECK is defined, it is "intercom".
| size_t intercom_tx | ( | IntercomChannel * | channel, |
| const void * | data, | ||
| size_t | data_size, | ||
| uint32_t | timeout ) |
Transmit data through Intercom.
intercom_channel_open() needs to be called first.The data will be automatically split into frames and sent asynchronously.
Blocks until the other chip signals that it's ready to accept messages on this channel.
| [in] | channel | Pointer to the acquired IntercomChannel instance |
| [in] | data | Pointer to the data to send |
| [in] | data_size | Number of bytes to send |
| [in] | timeout | Time to wait for the transmission to complete, in milliseconds |