-
Notifications
You must be signed in to change notification settings - Fork 14
/
message.h
43 lines (39 loc) · 944 Bytes
/
message.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
36
37
38
39
40
41
42
43
#ifndef __MESSAGES_H__
#define __MESSAGES_H__
#include <stdint.h>
typedef enum {
NORMAL = 0,
GPS,
BOOT = 0x80,
BOOTPGM_PAGE,
BOOTPGM_SIZE,
RESET,
SLEEP,
WAKEUP,
CHARGE,
VOLTAGE,
RUN,
READUID,
CALIB,
} message_type_t;
/**
* @brief Message structure.
*
* A message structure is 12 bytes in length and is composed of three
* parts: the payload (9 bytes), the message type (1 byte), and a CRC (2
* bytes).
*
* @note When preparing a message for transmission, at a minimum you
* must specify the type (use a value between 0 and 127 for user
* messages) and the CRC (use the message_crc() function for this
* purpose).
*
* @see message_crc, kilo_message_rx, kilo_message_tx,
* kilo_message_tx_success
*/
typedef struct {
uint8_t data[9]; ///< message payload.
uint8_t type; ///< message type.
uint16_t crc; ///< message crc.
} message_t;
#endif//__MESSAGES_H__