Class Remote

Nested Relationships

Nested Types

Class Documentation

class Remote

A unique UART handler that uses timing in leu of DBUS communication (modm does not support DBUS) to interact with the DR16 receiver.

Information for implementation was translated from a user manual for the DR16 that was only available in Chinese. AI-Translated version of document available here: https://drive.google.com/file/d/1-ZGe4mXVhxP4IEmHccphnzKzYWJyw3C3/view?usp=sharing

Public Types

enum class Channel

Specifies a particular joystick.

Values:

enumerator RIGHT_HORIZONTAL
enumerator RIGHT_VERTICAL
enumerator LEFT_HORIZONTAL
enumerator LEFT_VERTICAL
enumerator WHEEL
enum class Switch

Specifies a particular switch.

Values:

enumerator LEFT_SWITCH
enumerator RIGHT_SWITCH
enum class SwitchState

Different switch orientations.

Values:

enumerator UNKNOWN
enumerator UP
enumerator DOWN
enumerator MID
enum class Key

A list of the particular keys to interact with, in bit order.

Values:

enumerator W
enumerator S
enumerator A
enumerator D
enumerator SHIFT
enumerator CTRL
enumerator Q
enumerator E
enumerator R
enumerator F
enumerator G
enumerator Z
enumerator X
enumerator C
enumerator V
enumerator B

Public Functions

inline Remote(Drivers *drivers)
mockable ~Remote() = default
mockable void initialize ()

Enables and initializes bound_ports::REMOTE_SERIAL_UART_PORT.

mockable void read ()

Reads/parses the current buffer and updates the current remote info state and CommandMapper state.

mockable bool isConnected () const

Note

A timer is used to determine if the remote is disconnected, so expect a second or so of delay from disconnecting the remote to this function saying the remote is disconnected.

Returns:

true if the remote is connected, false otherwise.

mockable float getChannel (Channel ch) const
Returns:

The value of the given channel, between [-1, 1].

mockable SwitchState getSwitch (Switch sw) const
Returns:

The state of the given switch.

inline mockable int16_t getMouseX () const
Returns:

The current mouse x value.

inline mockable int16_t getMouseY () const
Returns:

The current mouse y value.

inline mockable int16_t getMouseZ () const
Returns:

The current mouse z value.

inline mockable bool getMouseL () const
Returns:

The current mouse l value.

inline mockable bool getMouseR () const
Returns:

The current mouse r value.

inline mockable bool keyPressed (Key key) const
Returns:

true if the given key is pressed, false otherwise.

mockable uint32_t getUpdateCounter () const
Returns:

the number of times remote info has been received.