TR-mbed 1.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
DJIRemote2 Class Reference

#include <DJIRemote2.h>

Public Types

enum class  Joystick { RIGHT_HORIZONTAL , RIGHT_VERTICAL , LEFT_HORIZONTAL , LEFT_VERTICAL }
 
enum class  ModeSwitch { MODE_C , MODE_N , MODE_S }
 
enum class  Key {
  W = 0 , S , A , D ,
  SHIFT , CTRL , Q , E ,
  R , F , G , Z ,
  X , C , V , B
}
 

Public Member Functions

 DJIRemote2 (PinName tx, PinName rx, int baud=921600)
 
bool update ()
 
void clear ()
 
void zeroInputs ()
 
const VTMInputgetData () const
 
bool hasValidFrame () const
 
uint64_t getLastFrameTimeUs () const
 
uint64_t getFramePeriodUs () const
 
double getFrameRateHz () const
 
bool TriggerPressed () const
 
bool CUSTLPressed () const
 
bool CUSTRPressed () const
 
bool PAUSEPressed () const
 
int16_t getMouseX () const
 
int16_t getMouseY () const
 
int16_t getMouseZ () const
 
bool getMouseL () const
 
bool getMouseR () const
 
bool keyPressed (Key key) const
 
int16_t getWheel () const
 
bool CUSTLToggled () const
 
bool CUSTRToggled () const
 
bool PAUSEToggled () const
 
float getJoystickValue (Joystick joy) const
 
float apply_deadzone (float value) const
 
float getDialValue () const
 
ModeSwitch getMode () const
 

Public Attributes

uint64_t prevFrameTime = 0
 

Static Public Attributes

static constexpr uint8_t HEADER_BYTE_0 = 0xA9
 
static constexpr uint8_t HEADER_BYTE_1 = 0x53
 
static constexpr size_t FRAME_SIZE = 21
 
static constexpr size_t STREAM_BUFFER_SIZE = 64
 
static constexpr float STICK_MAX_VALUE = 1684.0f
 

Member Enumeration Documentation

◆ Joystick

enum class DJIRemote2::Joystick
strong
Enumerator
RIGHT_HORIZONTAL 
RIGHT_VERTICAL 
LEFT_HORIZONTAL 
LEFT_VERTICAL 

◆ Key

enum class DJIRemote2::Key
strong
Enumerator
SHIFT 
CTRL 

◆ ModeSwitch

enum class DJIRemote2::ModeSwitch
strong
Enumerator
MODE_C 
MODE_N 
MODE_S 

Constructor & Destructor Documentation

◆ DJIRemote2()

DJIRemote2::DJIRemote2 ( PinName  tx,
PinName  rx,
int  baud = 921600 
)

Member Function Documentation

◆ apply_deadzone()

float DJIRemote2::apply_deadzone ( float  value) const

◆ clear()

void DJIRemote2::clear ( )

◆ CUSTLPressed()

bool DJIRemote2::CUSTLPressed ( ) const

◆ CUSTLToggled()

bool DJIRemote2::CUSTLToggled ( ) const

◆ CUSTRPressed()

bool DJIRemote2::CUSTRPressed ( ) const

◆ CUSTRToggled()

bool DJIRemote2::CUSTRToggled ( ) const

◆ getData()

const VTMInput & DJIRemote2::getData ( ) const

◆ getDialValue()

float DJIRemote2::getDialValue ( ) const

◆ getFramePeriodUs()

uint64_t DJIRemote2::getFramePeriodUs ( ) const

◆ getFrameRateHz()

double DJIRemote2::getFrameRateHz ( ) const

◆ getJoystickValue()

float DJIRemote2::getJoystickValue ( Joystick  joy) const

◆ getLastFrameTimeUs()

uint64_t DJIRemote2::getLastFrameTimeUs ( ) const

◆ getMode()

DJIRemote2::ModeSwitch DJIRemote2::getMode ( ) const

◆ getMouseL()

bool DJIRemote2::getMouseL ( ) const
Returns
The current mouse l value.

◆ getMouseR()

bool DJIRemote2::getMouseR ( ) const
Returns
The current mouse r value.

◆ getMouseX()

int16_t DJIRemote2::getMouseX ( ) const
Returns
The current mouse x value.

◆ getMouseY()

int16_t DJIRemote2::getMouseY ( ) const
Returns
The current mouse y value.

◆ getMouseZ()

int16_t DJIRemote2::getMouseZ ( ) const
Returns
The current mouse z value.

◆ getWheel()

int16_t DJIRemote2::getWheel ( ) const
Returns
the value of the wheel, between [-STICK_MAX_VALUE, STICK_MAX_VALUE].

◆ hasValidFrame()

bool DJIRemote2::hasValidFrame ( ) const

◆ keyPressed()

bool DJIRemote2::keyPressed ( Key  key) const
Returns
true if the given key is pressed, false otherwise.

◆ PAUSEPressed()

bool DJIRemote2::PAUSEPressed ( ) const

◆ PAUSEToggled()

bool DJIRemote2::PAUSEToggled ( ) const

◆ TriggerPressed()

bool DJIRemote2::TriggerPressed ( ) const

◆ update()

bool DJIRemote2::update ( )

◆ zeroInputs()

void DJIRemote2::zeroInputs ( )

Member Data Documentation

◆ FRAME_SIZE

constexpr size_t DJIRemote2::FRAME_SIZE = 21
staticconstexpr

◆ HEADER_BYTE_0

constexpr uint8_t DJIRemote2::HEADER_BYTE_0 = 0xA9
staticconstexpr

◆ HEADER_BYTE_1

constexpr uint8_t DJIRemote2::HEADER_BYTE_1 = 0x53
staticconstexpr

◆ prevFrameTime

uint64_t DJIRemote2::prevFrameTime = 0

◆ STICK_MAX_VALUE

constexpr float DJIRemote2::STICK_MAX_VALUE = 1684.0f
staticconstexpr

◆ STREAM_BUFFER_SIZE

constexpr size_t DJIRemote2::STREAM_BUFFER_SIZE = 64
staticconstexpr

The documentation for this class was generated from the following files: