Flipper Expansion Protocol parser reference implementation. More...
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | ExpansionFrameHeader |
Frame header structure. More... | |
struct | ExpansionFrameHeartbeat |
Heartbeat frame contents. More... | |
struct | ExpansionFrameStatus |
Status frame contents. More... | |
struct | ExpansionFrameBaudRate |
Baud rate frame contents. More... | |
struct | ExpansionFrameControl |
Control frame contents. More... | |
struct | ExpansionFrameData |
Data frame contents. More... | |
struct | ExpansionFrame |
Expansion protocol frame structure. More... | |
Typedefs | |
typedef uint8_t | ExpansionFrameChecksum |
Expansion checksum type. | |
typedef size_t(* | ExpansionFrameReceiveCallback) (uint8_t *data, size_t data_size, void *context) |
Receive function type declaration. | |
typedef size_t(* | ExpansionFrameSendCallback) (const uint8_t *data, size_t data_size, void *context) |
Send function type declaration. | |
Enumerations | |
enum | ExpansionFrameType { ExpansionFrameTypeHeartbeat = 1 , ExpansionFrameTypeStatus = 2 , ExpansionFrameTypeBaudRate = 3 , ExpansionFrameTypeControl = 4 , ExpansionFrameTypeData = 5 , ExpansionFrameTypeReserved } |
Enumeration of supported frame types. More... | |
enum | ExpansionFrameError { ExpansionFrameErrorNone = 0x00 , ExpansionFrameErrorUnknown = 0x01 , ExpansionFrameErrorBaudRate = 0x02 } |
Enumeration of possible error types. More... | |
enum | ExpansionFrameControlCommand { ExpansionFrameControlCommandStartRpc = 0x00 , ExpansionFrameControlCommandStopRpc = 0x01 , ExpansionFrameControlCommandEnableOtg = 0x02 , ExpansionFrameControlCommandDisableOtg = 0x03 } |
Enumeration of suported control commands. More... | |
enum | ExpansionProtocolStatus { ExpansionProtocolStatusOk , ExpansionProtocolStatusErrorFormat , ExpansionProtocolStatusErrorChecksum , ExpansionProtocolStatusErrorCommunication } |
Enumeration of protocol parser statuses. More... | |
Flipper Expansion Protocol parser reference implementation.
This file is licensed separately under The Unlicense. See https://unlicense.org/ for more details.
This parser is written with low-spec hardware in mind. It does not use dynamic memory allocation or Flipper-specific libraries and can be included directly into any module's firmware's sources.
typedef size_t(* ExpansionFrameReceiveCallback) (uint8_t *data, size_t data_size, void *context) |
Receive function type declaration.
[out] | data | pointer to the buffer to reveive the data into. |
[in] | data_size | maximum output buffer capacity, in bytes. |
[in,out] | context | pointer to a user-defined context object. |
typedef size_t(* ExpansionFrameSendCallback) (const uint8_t *data, size_t data_size, void *context) |
Send function type declaration.
[in] | data | pointer to the buffer containing the data to be sent. |
[in] | data_size | size of the data to send, in bytes. |
[in,out] | context | pointer to a user-defined context object. |
Enumeration of suported control commands.
enum ExpansionFrameError |
enum ExpansionFrameType |
Enumeration of supported frame types.