Welcome to mirror list, hosted at ThFree Co, Russian Federation.

serial_service.h « ble_glue « f6 « targets « firmware - github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a1e5bc1cc577f8a817376e7c9217d15df07cd063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include <stdint.h>
#include <stdbool.h>

#define SERIAL_SVC_DATA_LEN_MAX (486)
#define SERIAL_SVC_CHAR_VALUE_LEN_MAX (243)

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    SerialServiceEventTypeDataReceived,
    SerialServiceEventTypeDataSent,
} SerialServiceEventType;

typedef struct {
    uint8_t* buffer;
    uint16_t size;
} SerialServiceData;

typedef struct {
    SerialServiceEventType event;
    SerialServiceData data;
} SerialServiceEvent;

typedef uint16_t (*SerialServiceEventCallback)(SerialServiceEvent event, void* context);

void serial_svc_start();

void serial_svc_set_callbacks(
    uint16_t buff_size,
    SerialServiceEventCallback callback,
    void* context);

void serial_svc_notify_buffer_is_empty();

void serial_svc_stop();

bool serial_svc_is_started();

bool serial_svc_update_tx(uint8_t* data, uint16_t data_len);

#ifdef __cplusplus
}
#endif