forked from ArduPilot/ardupilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sub: minimal support for inheritting from RC_Channel
- Loading branch information
1 parent
9ce02bc
commit 1ba0901
Showing
6 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "Sub.h" | ||
|
||
#include "RC_Channel.h" | ||
|
||
// defining these two macros and including the RC_Channels_VarInfo | ||
// header defines the parameter information common to all vehicle | ||
// types | ||
#define RC_CHANNELS_SUBCLASS RC_Channels_Sub | ||
#define RC_CHANNEL_SUBCLASS RC_Channel_Sub | ||
|
||
#include <RC_Channel/RC_Channels_VarInfo.h> | ||
|
||
// note that this callback is not presently used on Plane: | ||
int8_t RC_Channels_Sub::flight_mode_channel_number() const | ||
{ | ||
return 1; // sub does not have a flight mode channel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include <RC_Channel/RC_Channel.h> | ||
|
||
class RC_Channel_Sub : public RC_Channel | ||
{ | ||
|
||
public: | ||
|
||
protected: | ||
|
||
private: | ||
|
||
}; | ||
|
||
class RC_Channels_Sub : public RC_Channels | ||
{ | ||
public: | ||
|
||
RC_Channel_Sub obj_channels[NUM_RC_CHANNELS]; | ||
RC_Channel_Sub *channel(const uint8_t chan) override { | ||
if (chan > NUM_RC_CHANNELS) { | ||
return nullptr; | ||
} | ||
return &obj_channels[chan]; | ||
} | ||
|
||
protected: | ||
|
||
// note that these callbacks are not presently used on Plane: | ||
int8_t flight_mode_channel_number() const override; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters