#include <otRFCom.h>
Public Types | |
| enum | Baud { B_2400, B_4800, B_9600, B_14400, B_19200, B_38400, B_57600, B_115200, B_128000, B_256000 } |
| enum | TransmitPower { P_13dBm, P_10dBm, P_8dBm, P_7dBm, P_5dBm, P_4dBm, P_2dBm, P_0dBm, M_3dBm, M_6dBm, M_10dBm, M_18dBm, M_30dBm } |
Public Member Functions | |
| otRFCom () | |
| void | init (U8 uart, U8 portId, U8 bit) |
| void | reset () |
| void | apply () |
| bool | setBaud (U16 baud) |
| bool | setFrequency (U16 MHz) |
| bool | setRetry (U8 retry) |
| bool | setTxId (U8 id4, U8 id3, U8 id2, U8 id1, U8 id0) |
| bool | setRxId (U8 id4, U8 id3, U8 id2, U8 id1, U8 id0) |
| bool | setTxPower (U8 power) |
|
|
|
|
|
|
Create the class |
|
|
After the RF-COM settings is completed call this function and the interface is ready to send/receive data according your settings. |
|
||||||||||||||||
|
Init the RF-COM interface and the related port for the control of CMD signal |
|
|
Reset the RF-COM interface restoring defaults: |
|
|
Set the baud rate.
|
|
|
Set Frequency.
|
|
|
Set the number of repeated transmission of data per frame, set the higher, the more reliable data transmission, but the data will be delayed longer. When you use it as a remote control, try to set a larger value to ensure reliability. When module sends data successfully, it does not resend again, even if it is set to 10 times in the transmission process, it may only transfer 3 times succeeded. The retransmissions is the maximum number of retransmissions after a failed transmission.
|
|
||||||||||||||||||||||||
|
Same of setTxId
|
|
||||||||||||||||||||||||
|
The transmission ID is the identifier of the radio data. In the case of the same frequency, only when the transmission ID and reception ID are the same, then can communicate with each other. That is to say all the modules whose reception ID are the same with the transmission ID of one module can receive the data it sends at the same time. Transmission ID has a total of 5 bytes. The transmission ID and reception ID of the same module can be the same or different.
|
|
|
This command can be set up to 14 kinds of transmission power, each transmission power, the module consumes the current is not the same, the greater the transmission power, the greater the current consumption, otherwise smaller.
|