其他分享
首页 > 其他分享> > 在CH579/CH573/CH57x 上使用RF_PHY 实现BLE广播

在CH579/CH573/CH57x 上使用RF_PHY 实现BLE广播

作者:互联网

本文由来

实现

初始化

void RF_Init( void ) {
    uint8 state;
    rfConfig_t rfConfig;

    taskID = TMOS_ProcessEventRegister( RF_ProcessEvent );
#if defined(CH573)
    rfConfig.accessAddress = 0x8E89BED6;
    rfConfig.CRCInit = 0x555555;
#elif defined(CH579)
    rfConfig.TxAccessAddress = 0x8E89BED6;
    rfConfig.RxAccessAddress = 0x8E89BED6;
    rfConfig.TxCRCInit = 0x555555;
    rfConfig.RxCRCInit = 0x555555;
#else
    #error "You must define CH573 or CH579 first!"
#endif
    rfConfig.Channel = 37;
    rfConfig.LLEMode = LLE_MODE_BASIC;
    rfConfig.rfStatusCB = RF_2G4StatusCallBack;
    state = RF_Config( &rfConfig );
    PRINT("rf 2.4g init state for ble adv test: %x\n",state);
}

构造数据

//ble adv data for RF-PHY test
static uint8_t ble_adv_test_data[] = {
                                0x3c,0x10,0x2D, 0xE4, 0xC2, 0x84,\\MAC ADDR
                                9,0x09,'A','D','V','-','T','E','S','T' \\ADV data
                              };

发送

uint8_t ble_adv_tx(void) {
    RF_Shut( );
   //tx type :0X02 for no connected adv 
   return RF_Tx( TX_DATA,sizeof(TX_DATA), 0x02, 0xFF );
}

标签:adv,CH57x,CH579,state,CH573,void,rfConfig,RF,ble
来源: https://www.cnblogs.com/iot-fan/p/14320405.html