forked from bartprescott/vbus-collector
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvbus.h
35 lines (30 loc) · 905 Bytes
/
vbus.h
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
// vbus.h
//
// (c) Hewell Technology Ltd. 2014
//
//****************************************************************************
#pragma once
typedef struct __attribute__((packed)) _VBUS_HEADER
{
unsigned char syncByte;
unsigned short dest;
unsigned short source;
unsigned char ver;
} VBUS_HEADER, *PVBUS_HEADER;
typedef struct _FRAME_STRUCT
{
unsigned char bytes[4];
unsigned char septett;
unsigned char crc;
} FRAME_STRUCT, *PFRAME_STRUCT;
typedef struct _VBUS_V1_CMD
{
VBUS_HEADER h;
unsigned short cmd;
unsigned char frameCnt;
unsigned char crc;
FRAME_STRUCT frame[];
} VBUS_V1_CMD, *PVBUS_V1_CMD;
extern unsigned char vbus_calc_crc(const unsigned char *buffer, int offset, int length);
extern void vbus_extract_septett(unsigned char *buffer, int offset, int length);
extern void vbus_inject_septett(unsigned char *buffer, int offset, int length);