blob: 0d60e873955c0036a1d03b8cfb1c0d9972c74ee7 (
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
|
#ifndef HYBBX_SIXPACK_H
#define HYBBX_SIXPACK_H
#include "hybbx/kiss.h"
#include "hybbx/types.h"
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define HYBBX_SIXPACK_LEAD 0x53u /* 'S' */
typedef void (*hybbx_sixpack_frame_cb)(const uint8_t *frame, size_t len,
void *userdata);
typedef struct hybbx_sixpack_decoder {
uint8_t buf[HYBBX_KISS_MAX_FRAME];
size_t len;
int in_frame;
uint8_t count;
uint8_t checksum;
} hybbx_sixpack_decoder_t;
void hybbx_sixpack_decoder_init(hybbx_sixpack_decoder_t *dec);
void hybbx_sixpack_decoder_feed(hybbx_sixpack_decoder_t *dec,
const uint8_t *data, size_t len,
hybbx_sixpack_frame_cb cb, void *userdata);
size_t hybbx_sixpack_encode(const uint8_t *frame, size_t frame_len,
uint8_t *out, size_t out_cap);
#ifdef __cplusplus
}
#endif
#endif /* HYBBX_SIXPACK_H */
|