ZHDA134 April 2026 CC1310 , CC1311P3 , CC1312PSIP , CC1312R , CC1312R7 , CC1314R10 , CC1350 , CC1352P , CC1352P7 , CC1352R , CC1354P10 , CC1354R10
与第 2.1.3 节中示例中所示设置相比,无需更改设置。
仅需执行以下修改:
需修改的代码位于在第 7 行和第 38-48 行。
1: //---------------------------------------------------------------------------------------------
2: // Transmit Standard Packet Format with CMD_PROP_TX_ADV (2 Length Bytes)
3: //---------------------------------------------------------------------------------------------
4:
5: // Defines
6: #define PAYLOAD_LENGTH 3 // Max 4093 bytes
7: #define LENGTH_FIELD 2 // Changed from 1
8:
9: uint8_t packet[LENGTH_FIELD + PAYLOAD_LENGTH];
10:
11: static RF_Object rfObject;
12: static RF_Handle rfHandle;
13:
14: void *mainThread(void *arg0)
15: {
16: RF_Params rfParams;
17: RF_Params_init(&rfParams);
18:
19: RF_cmdPropTxAdv.numHdrBits = 0x0; // Settings that must change to support
20: // the standard packet format
21:
22: RF_cmdPropTxAdv.pktLen = LENGTH_FIELD + PAYLOAD_LENGTH; // Application specific
23: RF_cmdPropTxAdv.pPkt = packet; // settings
24:
25: // Settings to modify if going from a PHY that uses the standard TX command
26: // to use the advanced TX command
27: RF_cmdPropTxAdv.condition.rule = 0x1;
28: RF_cmdPropTxAdv.pktConf.bUseCrc = 0x1;
29:
30: rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup,
31: &rfParams);
32: RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0);
33:
34: while(1)
35: {
36: //-------------------------------------------------------------------------------------
37: // Could be placed outside the while(1) since the packet does not change
38: #ifdef SLR_MODE
39: packet[0] = (uint8_t)(PAYLOAD_LENGTH);
40: packet[1] = (uint8_t)(PAYLOAD_LENGTH >> 8);
41: #else
42: packet[0] = (uint8_t)(PAYLOAD_LENGTH >> 8);
43: packet[1] = (uint8_t)(PAYLOAD_LENGTH);
44: #endif
45: for (uint16_t i = 2; i < (LENGTH_FIELD + PAYLOAD_LENGTH); i++)
46: {
47: packet[i] = i - 1;
48: }
49: //-------------------------------------------------------------------------------------
50: RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTxAdv, RF_PriorityNormal, NULL, 0);
51: RF_yield(rfHandle);
52: usleep(500000);
53: }
54: }
请注意,如果您正在使用 SimpleLink 远距离 (SLR) PHY 或传统远距离 PHY(仅限 CC13x0),则这两个长度字节的写入顺序需要与使用其他任何专有 PHY 时相反。