upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the HM-TRP Serial RF Pro transceiver. More...
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.
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 |
HMTRP | ( | int | uart | ) |
HMTRP Serial RF Pro transceiver constructor
uart | Default UART to use (0 or 1) |
boolean checkOK | ( | ) |
Looks for and verifies an OK response. This looks like "OK\r\n"
boolean dataAvailable | ( | long | millis | ) |
Checks to see if there is data available for reading
millis | Number of milliseconds to wait; 0 means no waiting (default). |
boolean getConfig | ( | long[] | freq, |
long[] | dataRate, | ||
int[] | rxBandwidth, | ||
short[] | modulation, | ||
short[] | txPower, | ||
long[] | uartBaud | ||
) |
Queries the radio to determine its configuration
freq | Operating frequency |
dataRate | TX/RX bit rate |
rxBandwidth | Receiving bandwidth in Khz |
modulation | Modulation frequency in Khz |
txPower | Transmission power (1-7) |
uartBaud | UART baud rate |
short getModSignalStrength | ( | ) | throws java.io.IOException |
Gets the modulation signal strength.
std::runtime_error | if reading from the sensor failed |
short getRFSignalStrength | ( | ) | throws java.io.IOException |
Gets the RF signal strength
std::runtime_error | if reading from the sensor failed |
boolean reset | ( | ) |
Resets the device to default parameters, except for the UART baud rate
boolean setFrequency | ( | long | freq | ) |
Sets the frequency. Note: this is limited depending on which HM-TRP device you are using. Consult the datasheet.
freq | Operating frequency |
boolean setFrequencyModulation | ( | short | modulation | ) |
Sets the frequency modulation. Valid values are between 10 and 160 (in Khz)
modulation | Frequency modulation to use, in Khz (10-160) |
boolean setRFDataRate | ( | long | rate | ) |
Sets the RF data transmission rate. Valid values are between 1,200 and 115,200.
rate | Radio transmission rate in baud (1,200-115,200) |
boolean setRXBandwidth | ( | int | rxBand | ) |
Sets the RX bandwidth. Valid values are between 30 and 620 (in Khz)
rxBand | RX bandwidth in Khz (30-620) |
boolean setTransmitPower | ( | short | power | ) |
Sets the transmit power level. Valid values are between 0 and 7, 7 being the maximum power.
power | Power level to use during transmission. Valid values are between 0 and 7. |
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.
speed | Desired baud rate to configure the device to use Valid values are between 1,200 and 115,200. |
boolean setupTty | ( | int | baud | ) |
Sets up proper tty I/O modes and the baud rate. The default baud rate is 9,600 (B9600).
baud | Desired baud rate. |