#include "ioCC2541.h"
#include "per_test_cc254x.h"
#include "prop_regs.h"
#include "hal_timer2.h"
#include "hal_sleep.h"
#include "hal_rf_proprietary.h"
#include "hal_int.h"
#include "hal_board.h"
#include "hal_button.h"
#include "hal_led.h"
#include "per_test_cc254x_strings.h"
#include "per_test_cc254x_query.h"
#include "hal_joystick.h"
#include "util_lcd.h"
unsigned char __xdata packetpoly[16]={0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6};
// Global flags.
extern volatile uint8 rfirqf1;
#if(POWER_SAVING)
uint8 powerModeFlag;
#endif
int main(void){
rfirqf1 = 0;
halBoardInit();
//packetpoly
// Turn on LED1 ( green ).
halLedSet(1);
while(1) {
// Set up radio in per test mode with the received configuration.
halRfDisableRadio(FORCE);
halRfInit();
halRfConfig(GFSK_250kbps_160khz, TX, 32, PKT_CONF_NRF);
halRfSetFrequency(2402);
halRfSetCrc(CRC_16_CCITT);
halRfSetSyncWord(SYNCWORD, 0);
halRfSetTxAddress(0xEF, ADDR_CONF_TX_AUTO, 16);
PRF.ADDR_ENTRY[0].CONF.REUSE = 1;
halRfCommand(CMD_TXFIFO_RESET);
halRfEnableRadio();
for(;;)
{
// 200 ms delay.
halMcuWaitMs(200);
// Set radio to transmit packets every 10 ms.
halRfPacketTxInterval(VALUE_10MS_IN_1US_UNITS);
// Enable RF interrupt.
halRfEnableInterrupt(RFIRQF1_TASKDONE);
// Enable global interrupt.
halIntOn();
// Load payload.
halRfPrepareTxPacket(sizeof(packetpoly),packetpoly);
// Start transmitter
halRfStartTx();
// Wait for TASKDONE and halt CPU (PM0) until task is completed.
while (!(rfirqf1 & RFIRQF1_TASKDONE)) {
#if(POWER_SAVING)
halSleepEnterPowerMode(CPU_HALT);
#endif
}
// Reset TXFIFO to clear any remaining data in buffer.
halRfCommand(CMD_TXFIFO_RESET);
// Clear the global RFIRQF1 shadow variable (RF Interrupt flags).
rfirqf1 = 0;
// Set to a undefined value in enum type end cause.
PRF.ENDCAUSE = TASK_UNDEF;
}
}
}
Susan Yang:
建议您在协议栈的例程内修改。另外您现在是自己设计的板子?