Revert "[extra_dl] Added an example of processing a payload_command packet"

This reverts commit 7402d0a1b4.
This commit is contained in:
Gautier Hattenberger
2017-03-19 23:11:03 +01:00
parent 205559e825
commit 1754ce0a41
3 changed files with 19 additions and 69 deletions
@@ -45,22 +45,8 @@
#include "modules/datalink/extra_pprz_dl.h"
#include "subsystems/datalink/telemetry.h"
#include "subsystems/datalink/datalink.h"
#include "pprzlink/pprz_transport.h"
#if USE_UDP
#include "mcu_periph/udp.h"
#endif
#if USE_USB_SERIAL
#include "mcu_periph/usb_serial.h"
#endif
bool extra_dl_msg_available;
uint8_t extra_dl_buffer[MSG_SIZE] __attribute__((aligned));
/* PPRZ transport structure */
struct pprz_transport extra_pprz_tp;
void extra_pprz_dl_init(void)
@@ -68,12 +54,6 @@ void extra_pprz_dl_init(void)
pprz_transport_init(&extra_pprz_tp);
}
extern void extra_pprz_dl_event(void)
{
pprz_check_and_parse(&EXTRA_DOWNLINK_DEVICE.device, &extra_pprz_tp, extra_dl_buffer, &extra_dl_msg_available);
DlCheckAndParse(&EXTRA_DOWNLINK_DEVICE.device, &extra_pprz_tp.trans_tx, extra_dl_buffer);
}
void extra_pprz_dl_periodic(void)
{
#if PERIODIC_TELEMETRY && defined(TELEMETRY_PROCESS_Extra)
@@ -82,21 +62,3 @@ void extra_pprz_dl_periodic(void)
#endif
}
void extra_pprz_dl_parse_payload_cmd(void)
{
// check if the command it meant for me
if (AC_ID != DL_PAYLOAD_COMMAND_ac_id(extra_dl_buffer)){
return;
}
// check if the payload length it correct
if (EXPECTED_PAYLOAD_LENGTH != DL_PAYLOAD_COMMAND_command_length(extra_dl_buffer)){
return;
}
// optionally we can check for PAYLOAD_COMMAND version etc, depending on what we define in the packet
if (DL_PAYLOAD_COMMAND_command(extra_dl_buffer)[PAYLOAD_CMD_IDX] == PAYLOAD_CMD_INFO){
// TODO: do something
}
}
+18 -13
View File
@@ -27,29 +27,34 @@
#ifndef EXTRA_PPRZ_DL_H
#define EXTRA_PPRZ_DL_H
// example of checking for correct PAYLOAD_COMMAND message
#define EXPECTED_PAYLOAD_LENGTH 8
#include "subsystems/datalink/datalink.h"
#include "pprzlink/pprz_transport.h"
// example of a payload command
#define PAYLOAD_CMD_INFO 1
#if USE_UDP
#include "mcu_periph/udp.h"
#endif
// so we don't have to remember the index of bytes
#define PAYLOAD_CMD_IDX 0
#if USE_USB_SERIAL
#include "mcu_periph/usb_serial.h"
#endif
/** Datalink Event */
void extra_pprz_dl_event(void);
/* PPRZ transport structure */
extern struct pprz_transport extra_pprz_tp;
/* Datalink Event */
#define ExtraDatalinkEvent() { \
pprz_check_and_parse(&EXTRA_DOWNLINK_DEVICE.device, &extra_pprz_tp, dl_buffer, &dl_msg_available); \
DlCheckAndParse(&EXTRA_DOWNLINK_DEVICE.device, &extra_pprz_tp.trans_tx, dl_buffer); \
}
/** Init function */
void extra_pprz_dl_init(void);
extern void extra_pprz_dl_init(void);
/** Periodic function
*
* should be called at TELEMETRY_FREQUENCY
*/
void extra_pprz_dl_periodic(void);
/** Process payload commands */
void extra_pprz_dl_parse_payload_cmd(void);
extern void extra_pprz_dl_periodic(void);
#endif /* EXTRA_PPRZ_DL_H */