upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Classes | Public Member Functions | List of all members

API for the HM-TRP Serial RF Pro transceiver. More...

Detailed Description

UPM support for the HM-TRP Serial RF Pro transceiver. This was tested specifically with the Grove Serial RF Pro transceiver. In theory, this class should work with the following devices:

HM-TRP-433: 414000000-454000000Hz HM-TRP-470: 450000000-490000000Hz HM-TRP-868: 849000000-889000000Hz HM-TRP-915: 895000000-935000000Hz

The only difference is the transmit and receive frequencies supported.

By default, the device simply sends and receives any data presented on its UART interface. It can be put into a configuration mode by grounding the CONFIG pin on the transceiver.

hmtrp.jpg

Classes

class  HMTRP_OPCODE_T
 

Public Member Functions

synchronized void delete ()
 
 HMTRP (int uart)
 
boolean dataAvailable (long millis)
 
boolean dataAvailable ()
 
int readData (byte[] buffer, int millis)
 
int readData (byte[] buffer)
 
int writeData (byte[] buffer)
 
boolean setupTty (int baud)
 
boolean setupTty ()
 
boolean checkOK ()
 
boolean reset ()
 
boolean getConfig (long[] freq, long[] dataRate, int[] rxBandwidth, short[] modulation, short[] txPower, long[] uartBaud)
 
boolean setFrequency (long freq)
 
boolean setRFDataRate (long rate)
 
boolean setRXBandwidth (int rxBand)
 
boolean setFrequencyModulation (short modulation)
 
boolean setTransmitPower (short power)
 
boolean setUARTSpeed (long speed)
 
short getRFSignalStrength () throws java.io.IOException
 
short getModSignalStrength () throws java.io.IOException
 

Constructor & Destructor Documentation

HMTRP ( int  uart)

HMTRP Serial RF Pro transceiver constructor

Parameters
uartDefault UART to use (0 or 1)

Member Function Documentation

boolean checkOK ( )

Looks for and verifies an OK response. This looks like "OK\r\n"

Returns
True if OK received
boolean dataAvailable ( long  millis)

Checks to see if there is data available for reading

Parameters
millisNumber of milliseconds to wait; 0 means no waiting (default).
Returns
True if there is data available for reading
boolean getConfig ( long[]  freq,
long[]  dataRate,
int[]  rxBandwidth,
short[]  modulation,
short[]  txPower,
long[]  uartBaud 
)

Queries the radio to determine its configuration

Parameters
freqOperating frequency
dataRateTX/RX bit rate
rxBandwidthReceiving bandwidth in Khz
modulationModulation frequency in Khz
txPowerTransmission power (1-7)
uartBaudUART baud rate
Returns
True if successful
short getModSignalStrength ( ) throws java.io.IOException

Gets the modulation signal strength.

Returns
Signal strength
Exceptions
std::runtime_errorif reading from the sensor failed
short getRFSignalStrength ( ) throws java.io.IOException

Gets the RF signal strength

Returns
Signal strength
Exceptions
std::runtime_errorif reading from the sensor failed
boolean reset ( )

Resets the device to default parameters, except for the UART baud rate

Returns
True if successful
boolean setFrequency ( long  freq)

Sets the frequency. Note: this is limited depending on which HM-TRP device you are using. Consult the datasheet.

Parameters
freqOperating frequency
Returns
True if successful
boolean setFrequencyModulation ( short  modulation)

Sets the frequency modulation. Valid values are between 10 and 160 (in Khz)

Parameters
modulationFrequency modulation to use, in Khz (10-160)
Returns
True if successful
boolean setRFDataRate ( long  rate)

Sets the RF data transmission rate. Valid values are between 1,200 and 115,200.

Parameters
rateRadio transmission rate in baud (1,200-115,200)
Returns
True if successful
boolean setRXBandwidth ( int  rxBand)

Sets the RX bandwidth. Valid values are between 30 and 620 (in Khz)

Parameters
rxBandRX bandwidth in Khz (30-620)
Returns
True if successful
boolean setTransmitPower ( short  power)

Sets the transmit power level. Valid values are between 0 and 7, 7 being the maximum power.

Parameters
powerPower level to use during transmission. Valid values are between 0 and 7.
Returns
True if successful
boolean setUARTSpeed ( long  speed)

Sets the configured baud rate of the UART. It is strongly recommended you do not change this, or you may lose the ability to communicate with the transceiver. Valid values are 1,200-115,200.

Parameters
speedDesired baud rate to configure the device to use Valid values are between 1,200 and 115,200.
Returns
True if successful
boolean setupTty ( int  baud)

Sets up proper tty I/O modes and the baud rate. The default baud rate is 9,600 (B9600).

Parameters
baudDesired baud rate.
Returns
True if successful

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