Skip to content

Commit

Permalink
fix: Reorder definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Jul 4, 2019
1 parent 12a168b commit d72f43b
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions examples/Commander/Commander.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#include <serde-commander.h>

// RX Commands
// TX commands

struct Feedback
{
float mBatteryLevel;
};

SERDE_COMMANDER_CREATE_TX(CommanderTX, Feedback);

// RX Commands --

struct Move
{
Expand All @@ -15,18 +24,6 @@ struct Rotate

struct RequestFeedback {}; // Command has no arguments

// TX commands

struct Feedback
{
float mBatteryLevel;
};

SERDE_COMMANDER_CREATE_RX(CommanderRX, Move, Rotate, RequestFeedback);
SERDE_COMMANDER_CREATE_TX(CommanderTX, Feedback);

// --

// Callbacks must have the following signature:
// void onTypeNameReceived(const TypeName&)
void onMoveReceived(const Move& move)
Expand All @@ -47,6 +44,8 @@ void onRequestFeedbackReceived(const RequestFeedback& _)
CommanderTX::send(feedback, SERIAL_PORT_HARDWARE);
}

SERDE_COMMANDER_CREATE_RX(CommanderRX, Move, Rotate, RequestFeedback);

// --

void setup()
Expand Down

0 comments on commit d72f43b

Please sign in to comment.