forked from arduino/portentax8-x8h7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
x8h7.h
27 lines (22 loc) · 754 Bytes
/
x8h7.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
/**
* Portenta X8H7
*/
#ifndef __X8H7_H
#define __X8H7_H
#define X8H7_RX_TIMEOUT (HZ/10)
#define X8H7_BUF_SIZE (256)
#define FIXED_PACKET_LEN X8H7_BUF_SIZE
#define X8H7_PKT_SIZE (X8H7_BUF_SIZE - 8)
typedef struct {
uint8_t peripheral;
uint8_t opcode;
uint16_t size;
uint8_t data[X8H7_PKT_SIZE];
} x8h7_pkt_t;
typedef void (*x8h7_hook_t)(void *priv, x8h7_pkt_t *pkt);
int x8h7_pkt_send_sync(uint8_t peripheral, uint8_t opcode, uint16_t size, void *data);
int x8h7_pkt_send_defer(uint8_t peripheral, uint8_t opcode, uint16_t size, void *data);
int x8h7_pkt_send_now(void);
int x8h7_hook_set(uint8_t idx, x8h7_hook_t hook, void *priv);
int x8h7_dbg_set(void (*hook)(void*, uint8_t*, uint16_t), void *priv);
#endif /* __X8H7_H */