dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
msp.h
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  *
25  * Additional note on redistribution: The copyright and license notices above
26  * must be maintained in each individual source file that is a derivative work
27  * of this source file; otherwise redistribution is prohibited.
28  */
29 
30 #ifndef MSP_H_
31 #define MSP_H_
32 
33 #include "pios.h"
34 #include "msp_messages.h"
35 
37 struct msp_parser;
38 
48 typedef bool (*msp_handler_t)(enum msp_message_id msg_id, void *data, uint8_t len, void *context);
49 
54 };
55 
69 int32_t msp_process_buffer(struct msp_parser *parser, void *buf, uint8_t len);
76 int32_t msp_process_com(struct msp_parser *parser, struct pios_com_dev *com);
86 int32_t msp_send_com(struct msp_parser *parser, struct pios_com_dev *com, enum msp_message_id msg_id, void *payload, uint8_t len);
95 int32_t msp_register_handler(struct msp_parser *parser, msp_handler_t handler, void *context);
96 
97 #endif // MSP_H_
98 
msp_handler_t handler
Definition: msp.c:54
int32_t msp_send_com(struct msp_parser *parser, struct pios_com_dev *com, enum msp_message_id msg_id, void *payload, uint8_t len)
Construct and send an MSP message via PIOS_COM.
Definition: msp.c:235
Main PiOS header to include all the compiled in PiOS options.
msp_parser_type
Definition: msp.h:51
int32_t msp_register_handler(struct msp_parser *parser, msp_handler_t handler, void *context)
Register a handler for valid received messages.
Definition: msp.c:255
uint8_t payload[CRSF_MAX_PAYLOAD+CRSF_CRC_LEN]
uint8_t data[XFER_BYTES_PER_PACKET]
Definition: bl_messages.h:129
msp_message_id
Definition: msp_messages.h:41
int32_t msp_process_buffer(struct msp_parser *parser, void *buf, uint8_t len)
Process MSP stream from buffer.
Definition: msp.c:208
uint8_t type
bool(* msp_handler_t)(enum msp_message_id msg_id, void *data, uint8_t len, void *context)
Handler to be called when valid MSP messages are recieved.
Definition: msp.h:48
int32_t msp_process_com(struct msp_parser *parser, struct pios_com_dev *com)
Process MSP stream from PIOS_COM.
Definition: msp.c:219
Definition: msp.c:51
struct msp_parser * msp_parser_init(enum msp_parser_type type)
Initialize a new parser instance.
Definition: msp.c:193