ECRobot C++ API for LEGO MINDSTORMS NXT  1.0.10
ecrobot::Rs485 Class Reference

RS485 communication class. More...

#include <Rs485.h>

List of all members.

Public Member Functions

 Rs485 (U32 baudRate=LEGO_DEFAULT_BAUD_RATE)
 Constructor.
 ~Rs485 (void)
 Destructor (disable RS485).
U32 send (U8 *data, U32 offset, U32 length)
 Send data.
U32 receive (U8 *data, U32 offset, U32 length) const
 Receive data.

Static Public Attributes

static const U32 MAX_RS485_DATA_LENGTH = 64
 Maximum length of data in byte for send/receive.
static const U32 LEGO_DEFAULT_BAUD_RATE = 921600
 LEGO default baud rate [bps].

Detailed Description

RS485 communication class.

NXT sensor port 4 should be used for RS485 communication.
Default configrations:
921600 [bps]
Asynchronous mode
8 bits character length
1 stop bit
No parity check


Constructor & Destructor Documentation

Constructor.

Note:
This class must be constructed as a global object. Otherwise, a device assertion will be displayed
in the LCD when the object is constructed as a non global object. When the object is destructed while the system is shut down, RS485 is disabled automatically.

Parameters:
baudRateRS485 baud rate [bps]
Returns:
-

Destructor (disable RS485).

Parameters:
-
Returns:
-

Member Function Documentation

U32 ecrobot::Rs485::receive ( U8 *  data,
U32  offset,
U32  length 
) const

Receive data.

Parameters:
dataData to be received
offsetOffset of data to be received
lengthLength of data to be received
Returns:
Length of received data
U32 ecrobot::Rs485::send ( U8 *  data,
U32  offset,
U32  length 
)

Send data.

Parameters:
dataData to be sent
offsetOffset of data to be sent
lengthLength of data to be sent
Returns:
Length of sent data

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines