-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from nasa/96-add-daco-device
add daco THC device
- Loading branch information
Showing
15 changed files
with
225 additions
and
1 deletion.
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
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,56 @@ | ||
/* | ||
PURPOSE: | ||
LIBRARY DEPENDENCIES: ( | ||
(idf/DacoThc.cpp) | ||
) | ||
*/ | ||
|
||
/** | ||
* @trick_parse{everything} | ||
* @trick_link_dependency{idf/DacoThc.cpp} | ||
*/ | ||
|
||
#ifndef DACO_THC_HH | ||
#define DACO_THC_HH | ||
|
||
#include "idf/InputLayout.hh" | ||
#include "idf/SingleInput.hh" | ||
|
||
namespace idf { | ||
|
||
/** | ||
* %DacoThc DF0201 3 Axes 5 Switch Controller input layout | ||
* | ||
* @author Philip Kunz | ||
*/ | ||
class DacoThc : public virtual InputLayout { | ||
|
||
public: | ||
|
||
/** constructor */ | ||
DacoThc(); | ||
|
||
/** destructor */ | ||
virtual ~DacoThc() {}; | ||
|
||
/** forward backward */ | ||
SingleInput forwardBackwardTranslation; | ||
|
||
/** y axis */ | ||
SingleInput leftRightTranslation; | ||
|
||
/** z axis */ | ||
SingleInput upDownTranslation; | ||
|
||
/** switch */ | ||
SingleInput switch1; | ||
|
||
protected: | ||
|
||
virtual const std::vector<Configurable>& getConfigurables(); | ||
|
||
}; | ||
|
||
} // namespace | ||
|
||
#endif |
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
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,35 @@ | ||
/* | ||
PURPOSE: | ||
LIBRARY DEPENDENCIES: ( | ||
(idf/UsbDacoThc.cpp) | ||
) | ||
*/ | ||
|
||
/** | ||
* @trick_parse{everything} | ||
* @trick_link_dependency{idf/UsbDacoThc.cpp} | ||
*/ | ||
|
||
#ifndef USB_DACO_THC_HH | ||
#define USB_DACO_THC_HH | ||
|
||
#include "idf/UsbDevice.hh" | ||
#include "idf/DacoThc.hh" | ||
|
||
namespace idf { | ||
|
||
/** USB DacoThc DF0201 3 Axis 5 Switch Controller */ | ||
class UsbDacoThc : public UsbDevice, public DacoThc { | ||
|
||
public: | ||
|
||
/* constructor */ | ||
UsbDacoThc(); | ||
|
||
void decode(const std::vector<unsigned char>& data); | ||
|
||
}; | ||
|
||
} // namespace idf | ||
|
||
#endif |
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,22 @@ | ||
#include "idf/DacoThc.hh" | ||
|
||
namespace idf { | ||
|
||
DacoThc::DacoThc() : | ||
forwardBackwardTranslation(0, 65535, 32768), | ||
leftRightTranslation(0, 65535, 32768), | ||
upDownTranslation(0, 65535, 32768), | ||
switch1(0, 1) {} | ||
|
||
const std::vector<InputLayout::Configurable>& DacoThc::getConfigurables() { | ||
static std::vector<Configurable> inputs; | ||
if (inputs.empty()) { | ||
append(InputLayout::getConfigurables(), inputs); | ||
inputs.push_back(Configurable(forwardBackwardTranslation, "Forward/Backward Translation", "forwardBackwardTranslation")); | ||
inputs.push_back(Configurable(leftRightTranslation, "Left/Right Translation", "leftRightTranslation")); | ||
inputs.push_back(Configurable(upDownTranslation, "Up/Down Translation", "upDownTranslation")); | ||
} | ||
return inputs; | ||
} | ||
|
||
} // namespace idf |
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
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,16 @@ | ||
#include "idf/UsbDacoThc.hh" | ||
|
||
namespace idf { | ||
|
||
UsbDacoThc::UsbDacoThc() : | ||
UsbDevice("Daco THC DF0201", 7) {} | ||
|
||
void UsbDacoThc::decode(const std::vector<unsigned char>& data) { | ||
leftRightTranslation.setValue(((unsigned)data[1] << 8) | data[0]); | ||
upDownTranslation.setValue(((unsigned)data[3] << 8) | data[2]); | ||
forwardBackwardTranslation.setValue(((unsigned)data[5] << 8) | data[4]); | ||
|
||
switch1.setValue(data[6] & 0x1); | ||
} | ||
|
||
} // namespace idf |
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