All RCL commands that involve a TX operation have a txPower field as part of the command struct in order to configure the TX output power.
The available TX power settings are found in a TX power table (LRF_TxPowerTable) provided as part of the radio setup, which is defined as follows:
Usage
For a normal user or stack developer, the usage will be as follows:
- In the txPower field, the wanted dBm value of the TX power is written
- Setting TX output power requires constructing a struct and setting the wanted value to the txPower field
- The RCL will use the nearest entry in the table that is equal to or less than the requested power value (e.g. 7dBm might be rounded to 6dBm, and -5dBm might be rounded to -8dBm)
- Special values (LRF_TxPower_Use_Min and LRF_TxPower_Use_Max) are available for selecting the maximum and minimum available TX power
- If in the table, no output power is available below the requested setting, an error is returned
Examples
Recommended
The recommended way to set TX output power is using designated initializers, either setting .dBm and .fraction or .rawValue
void runGenericTxWithTxPowerSet(void)
{
ExampleRCL_GenericHdrDef hdrDef = FSK_hdrDef_DefaultRuntime();
RCL_Buffer_TxBuffer *txBuffers[NUM_PKT];
RCL_Handle h =
RCL_open(&rclClient, &LRF_configGfsk500Kbps);
for (int i = 0; i < NUM_PKT; i++)
{
txBuffers[i] = (RCL_Buffer_TxBuffer *)pktBuffer[i];
}
RCL_CmdGenericTx cmd;
cmd.common.runtime.callback = defaultCallback;
cmd.rfFrequency = FREQUENCY;
cmd.syncWord = SYNCWORD;
generatePackets(txBuffers, NUM_PKT, PKT_LEN, &hdrDef, EXAMPLE_HDR);
for(int i = 0; i < NUM_PKT; i++)
{
}
for (int i = 0; i < NUM_PKT; i++)
{
cmd.common.timing.absStartTime = nextTime;
}
}
Alternative
The user can also set TX output power by assigning the value to an existing structure's member.
cmd.txPower.dBm = 7;
cmd.txPower.fraction = 0;
cmd.txPower.rawValue = 14;
Special settings
Special settings are another way to set the Tx output power, either to the maximum or the minimum available in the table
Advanced
This setting is intented for advanced users only and is not recommended
If the user set txPower to Raw, then value.rawValue and the temperature coefficient needs to be set.
uint32_t value = 31520;
uint32_t temperatureCoefficient = 80;