IRrc
Public Member Functions | Protected Member Functions | Protected Attributes
IRheli Class Reference

Control class for Chinsese 3 channel Infra-red Coaxial helicopters etc. More...

#include <IRheli.h>

Inheritance diagram for IRheli:
Inheritance graph
[legend]
Collaboration diagram for IRheli:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 IRheli ()
 Constructor.
void setChannel (uint8_t channel)
void setCommand (uint8_t throttle, uint8_t rudder, uint8_t elevator, uint8_t ruddertrim)
void sendCommand (uint8_t throttle, uint8_t rudder, uint8_t elevator, uint8_t ruddertrim)
void poll ()
- Public Member Functions inherited from IRrc
 IRrc ()
 Constructor.
void sendMessage (const uint8_t *msg, uint8_t len)
void sendPreamble ()
void sendPostamble ()
 Send the postamble which consists by default of a single One bit sent with sendOne()
void sendZero ()
void sendOne ()
void enableCarrier ()
void disableCarrier ()
void carrierOn (uint16_t time)
void carrierOff (uint16_t time)

Protected Member Functions

void sendCurrentCommand ()
 Sends the most recently set command.

Protected Attributes

uint8_t _channel
 The currently selected channel, as set by setChannel(). Defaults to IR_HELI_CHANNEL_A.
- Protected Attributes inherited from IRrc
uint16_t _carrierFrequency
 IR Carrier frequence in Hertz.
uint16_t _preamble
 Length of the preamble carrier on time in microseconds.
uint16_t _preambleGap
 Length of the preamble gap off time in microseconds.
uint16_t _zeroOnTime
 Time that the carrier is on at the start of a Zero bit in microseconds.
uint16_t _zeroOffTime
 Time that the carrier is off at the end of a Zero bit in microseconds.
uint16_t _oneOnTime
 Time that the carrier is on at the start of a One bit in microseconds.
uint16_t _oneOffTime
 Time that the carrier is off at the end of a One bit in microseconds.

Detailed Description

Control class for Chinsese 3 channel Infra-red Coaxial helicopters etc.

Subclass of IRrc for typical 3 channel Chinese coaxial helicopters like:

Basic usage

The poll() call retransmits the most recently set command at an appropriate interval. The appropriate interval depends on the channel in use, and the intervals for each channel have been chosen to minimise collissions between multiple IRheli transmnitters that might be active in the same room at the same time.

Protocol

Protocol as described in http://www.rcgroups.com/forums/showthread.php?t=1231421&page=2 as follows: Commands are preceded by the preamble and followed by the postamble

byte,bit explanation. Bits numbered from MSB (transmitted first) to LSB (transmitted last)


Constructor & Destructor Documentation

IRheli::IRheli ( )

Member Function Documentation

void IRheli::poll ( )

If a command is due to be retransmitted, resends the last set command. Caution: If a command is to be sent, blocks for about 40ms until the command is sent.

References _channel, and sendCurrentCommand().

void IRheli::sendCommand ( uint8_t  throttle,
uint8_t  rudder,
uint8_t  elevator,
uint8_t  ruddertrim 
)

Sends immediately a command for the specified control setting. The same command will be sent thereafer when poll() is called and a retransmission is required. Caution: blocks until the command is sent.

Parameters:
[in]throttleThrottle setting. 0 is min, max is 255
[in]rudderRudder setting. 0 = full left, 127 = neutral 255 = full right
[in]elevatorElevator setting. 0 = full nose down, 127 = neutral 255 = full nose up
[in]ruddertrimRudderTrim setting. 0 = full left, 127 = neutral 255 = full right

References sendCurrentCommand(), and setCommand().

void IRheli::setChannel ( uint8_t  channel)

Specifies the channel the helico-tper listens to, A, B or C. Each helicoipter is hardwired For a specific channel, which is usually marked on the side of the helicopter.

Parameters:
[in]channelChannel to use, IR_HELI_CHANNEL_A, IR_HELI_CHANNEL_C, IR_HELI_CHANNEL_C

References _channel.

void IRheli::setCommand ( uint8_t  throttle,
uint8_t  rudder,
uint8_t  elevator,
uint8_t  ruddertrim 
)

Sets the comand to be sent next time poll() is called. Encodes the settings of throttle, rudder, elevator and ruddertrim and channel into the complete command, including checksum. The resulting command will be transmitted at appropriate intervals if poll() is called frequently enough.

Parameters:
[in]throttleThrottle setting. 0 is min, max is 255
[in]rudderRudder setting. 0 = full left, 127 = neutral 255 = full right
[in]elevatorElevator setting. 0 = full nose down, 127 = neutral 255 = full nose up
[in]ruddertrimRudderTrim setting. 0 = full left, 127 = neutral 255 = full right

References _channel.

Referenced by sendCommand().


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