HRI board firmware v2.1 Microcontroller firmware of the board used during the HRI labs.

definitions.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2017 EPFL-LSRO (Laboratoire de Systemes Robotiques).
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef DEF_DEFINITIONS_H
18 #define DEF_DEFINITIONS_H
19
20 #include <stdbool.h>
21
22 // Message IDs sent by host (PC) to the device (STM).
23 typedef enum
24 {
25 PC_MESSAGE_DO_NOTHING = 0,
26 PC_MESSAGE_PING,
27 PC_MESSAGE_GET_VARS_LIST,
28 PC_MESSAGE_SET_STREAMED_VAR,
29 PC_MESSAGE_GET_VAR,
30 PC_MESSAGE_SET_VAR
31 } comm_PcMessage;
32
33 // Message IDs sent by device (STM) to the device (PC).
34 typedef enum
35 {
36 STM_MESSAGE_PINGBACK = 0,
37 STM_MESSAGE_VAR,
38 STM_MESSAGE_STREAMING_PACKET,
39 STM_MESSAGE_DEBUG_TEXT,
40 STM_MESSAGE_VARS_LIST,
41 STM_MESSAGE_START_INFO
42 } comm_StmMessage;
43
44 // SyncVar.
45 #define N_SYNCVARS_MAX 255 // Maximum number of SyncVars.
46 #define SYNCVAR_NAME_SIZE 50 // Max size of a SyncVar name, including the '\0' trailing character.
47
48 typedef enum
49 {
50 READONLY = 0,
51 WRITEONLY,
52 READWRITE
53 } comm_VarAccess;
54
55 typedef enum
56 {
57 BOOL = 0,
58 UINT8, INT8, UINT16, INT16, UINT32, INT32, UINT64, INT64,
59 FLOAT32, FLOAT64
60 } comm_VarType;
61
62 // UART baudrate [b/s].
63 #define UART_BAUDRATE 1843200
64
65 #endif
READWRITE
Definition: definitions.h:52
FLOAT32
Definition: definitions.h:59
INT16
Definition: definitions.h:58
BOOL
Definition: definitions.h:57
UINT8
Definition: definitions.h:58
PC_MESSAGE_PING
Request the board an answer, to check the connection status.
Definition: definitions.h:26
STM_MESSAGE_VAR
Variable state.
Definition: definitions.h:37
UINT32
Definition: definitions.h:58
INT32
Definition: definitions.h:58
PC_MESSAGE_SET_STREAMED_VAR
Set the variables to be streamed continuously.
Definition: definitions.h:28
WRITEONLY
Definition: definitions.h:51
FLOAT64
Definition: definitions.h:59
INT64
Definition: definitions.h:58
STM_MESSAGE_START_INFO
Notification that the board has (re)started.
Definition: definitions.h:41
STM_MESSAGE_PINGBACK
Response to a ping request.
Definition: definitions.h:36
STM_MESSAGE_VARS_LIST
Monitored variables list.
Definition: definitions.h:40
READONLY
Definition: definitions.h:50
UINT64
Definition: definitions.h:58
comm_VarType
comm_VarType
Definition: definitions.h:55
PC_MESSAGE_GET_VAR
Request the device to send the selected value.
Definition: definitions.h:29
comm_VarAccess
comm_VarAccess
Definition: definitions.h:48
UINT16
Definition: definitions.h:58
STM_MESSAGE_DEBUG_TEXT
Debug text message.
Definition: definitions.h:39
INT8
Definition: definitions.h:58
STM_MESSAGE_STREAMING_PACKET
Streaming packet.
Definition: definitions.h:38
PC_MESSAGE_DO_NOTHING
Do nothing.
Definition: definitions.h:25
comm_StmMessage
comm_StmMessage
Definition: definitions.h:34
PC_MESSAGE_GET_VARS_LIST
Request the SyncVars list.
Definition: definitions.h:27
comm_PcMessage
comm_PcMessage
Definition: definitions.h:23
PC_MESSAGE_SET_VAR
Set the selected variable.
Definition: definitions.h:30