2021-09-09 21:11:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2021-12-08 13:59:40 +00:00
|
|
|
#define SERIAL_SVC_DATA_LEN_MAX (486)
|
2021-10-12 11:48:34 +00:00
|
|
|
|
2021-09-09 21:11:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-12-08 11:28:01 +00:00
|
|
|
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);
|
2021-10-12 16:41:42 +00:00
|
|
|
|
2021-09-13 11:25:37 +00:00
|
|
|
void serial_svc_start();
|
2021-09-09 21:11:32 +00:00
|
|
|
|
2021-12-08 11:28:01 +00:00
|
|
|
void serial_svc_set_callbacks(uint16_t buff_size, SerialServiceEventCallback callback, void* context);
|
2021-11-08 19:41:40 +00:00
|
|
|
|
|
|
|
void serial_svc_notify_buffer_is_empty();
|
2021-10-12 11:48:34 +00:00
|
|
|
|
2021-09-13 11:25:37 +00:00
|
|
|
void serial_svc_stop();
|
2021-09-09 21:11:32 +00:00
|
|
|
|
2021-12-08 11:28:01 +00:00
|
|
|
bool serial_svc_is_started();
|
|
|
|
|
2021-12-08 13:59:40 +00:00
|
|
|
bool serial_svc_update_tx(uint8_t* data, uint16_t data_len);
|
2021-09-09 21:11:32 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|