使用BOOST_MP11_VERSION宏的示例代码

161 篇文章 ¥59.90 ¥99.00
这段示例展示了如何使用BOOST_MP11_VERSION宏检测C++11支持。如果编译器不支持C++11,代码将输出错误信息并返回1。同时,它演示了Boost MP11库的元编程组件,如mp_int和mp_list的使用。

使用BOOST_MP11_VERSION宏的示例代码

BOOST_MP11_VERSION宏是Boost C++库中的一个版本宏,用于确定使用的编译器是否支持C++11标准及其后续版本。下面是一段使用BOOST_MP11_VERSION宏的示例代码:

#include <boost/mp11.hpp>
#include <iostream>

template<typename T>
void print_type() {
    std::cout << typeid(T).name() << std::endl;
}

int main() {
    // 判断编译器是否支持 C++11 版本
#if BOOST_MP11_VERSION < 107000
    std::cout << "Your compiler does not support C++11 or later." << std::endl;
    return 1;
#else
    std::cout << "Your compiler supports C++11 or later." << std::endl;
#endif

    // 输出变量类型
    print_type<boost::mp11::mp_int<42>>();
    print_type<boost::mp11::mp_list<int, float, double>>();

    return 0;
}
/* * ======== ti_radio_config.c ======== * Configured RadioConfig module definitions * * DO NOT EDIT - This file is generated for the CC1352P7RGZ * by the SysConfig tool. * * Radio Config module version : 1.18.0 * SmartRF Studio data version : 2.30.0 */ #include "ti_radio_config.h" #include DeviceFamily_constructPath(driverlib/rf_bt5_coex.h) #include DeviceFamily_constructPath(rf_patches/rf_patch_cpe_multi_bt5_coex.h) #include DeviceFamily_constructPath(rf_patches/rf_patch_rfe_ble_coex.h) #include DeviceFamily_constructPath(rf_patches/rf_patch_mce_bt5.h) // Custom overrides #include <ti/ble5stack/icall/inc/ble_overrides.h> // ********************************************************************************* // BLE/WiFi Co-Existence configuration // ********************************************************************************* rfCoreHal_bleCoExConfig_t coexConfig = { .coExEnable.bCoExEnable = 1, .coExEnable.bUseREQUEST = 1, .coExEnable.bUseGRANT = 1, .coExEnable.bUsePRIORITY = 1, .coExEnable.bRequestForChain = 0, .coExTxRxIndication = 1, .priorityIndicationTime = 20, .grantLatencyTime = 60, .overrideConfig.bUseOverridePriority = 0, .overrideConfig.overridePriority = 0, .overrideConfig.bUseOverrideRequestForRx = 0, .overrideConfig.overrideRequestForRx = 0, .cmdBleMasterSlaveConfig.defaultPriority = 0, .cmdBleMasterSlaveConfig.bAssertRequestForRx = 1, .cmdBleMasterSlaveConfig.bIgnoreGrantInRx = 0, .cmdBleMasterSlaveConfig.bKeepRequestIfNoGrant = 0, .cmdBleAdvConfig.defaultPriority = 0, .cmdBleAdvConfig.bAssertRequestForRx = 1, .cmdBleAdvConfig.bIgnoreGrantInRx = 0, .cmdBleAdvConfig.bKeepRequestIfNoGrant = 0, .cmdBleScanConfig.defaultPriority = 0, .cmdBleScanConfig.bAssertRequestForRx = 1, .cmdBleScanConfig.bIgnoreGrantInRx = 0, .cmdBleScanConfig.bKeepRequestIfNoGrant = 0, .cmdBleInitConfig.defaultPriority = 0, .cmdBleInitConfig.bAssertRequestForRx = 1, .cmdBleInitConfig.bIgnoreGrantInRx = 0, .cmdBleInitConfig.bKeepRequestIfNoGrant = 0, .cmdBleGenericRxConfig.defaultPriority = 0, .cmdBleGenericRxConfig.bAssertRequestForRx = 1, .cmdBleGenericRxConfig.bIgnoreGrantInRx = 0, .cmdBleGenericRxConfig.bKeepRequestIfNoGrant = 0, .cmdBleTxTestConfig.defaultPriority = 0, .cmdBleTxTestConfig.bAssertRequestForRx = 1, .cmdBleTxTestConfig.bIgnoreGrantInRx = 0, .cmdBleTxTestConfig.bKeepRequestIfNoGrant = 0 }; // ********************************************************************************* // RF Frontend configuration // ********************************************************************************* // RF design based on: LP_CC1352P7-4 // TX Power tables // The RF_TxPowerTable_DEFAULT_PA_ENTRY and RF_TxPowerTable_HIGH_PA_ENTRY macros are defined in RF.h. // The following arguments are required: // RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost, coefficient) // RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim) // See the Technical Reference Manual for further details about the "txPower" Command field. // The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise. // 2400 MHz, 5 dBm RF_TxPowerTable_Entry txPowerTable_2400_pa5[TXPOWERTABLE_2400_PA5_SIZE] = { {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 2) }, // 0x04C8 {-18, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 2) }, // 0x04CA {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 3, 0, 3) }, // 0x06CD {-12, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 5) }, // 0x0AD0 {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 3, 0, 5) }, // 0x0AD3 {-9, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 6) }, // 0x0CD4 {-6, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 2, 0, 11) }, // 0x1693 {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(21, 2, 0, 11) }, // 0x1695 {-3, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 2, 0, 12) }, // 0x1899 {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 22) }, // 0x2C5D {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 1, 0, 25) }, // 0x3261 {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(38, 1, 0, 31) }, // 0x3E66 {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(47, 1, 0, 36) }, // 0x486F {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(32, 0, 0, 65) }, // 0x8220 {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(46, 0, 0, 59) }, // 0x762E RF_TxPowerTable_TERMINATION_ENTRY }; // 2400 MHz, 5 + 20 dBm RF_TxPowerTable_Entry txPowerTable_2400_pa5_10[TXPOWERTABLE_2400_PA5_10_SIZE] = { {-20, RF_TxPowerTable_DEFAULT_PA_ENTRY(8, 3, 0, 2) }, // 0x04C8 {-18, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 3, 0, 2) }, // 0x04CA {-15, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 3, 0, 3) }, // 0x06CD {-12, RF_TxPowerTable_DEFAULT_PA_ENTRY(16, 3, 0, 5) }, // 0x0AD0 {-10, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 3, 0, 5) }, // 0x0AD3 {-9, RF_TxPowerTable_DEFAULT_PA_ENTRY(20, 3, 0, 6) }, // 0x0CD4 {-6, RF_TxPowerTable_DEFAULT_PA_ENTRY(19, 2, 0, 11) }, // 0x1693 {-5, RF_TxPowerTable_DEFAULT_PA_ENTRY(21, 2, 0, 11) }, // 0x1695 {-3, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 2, 0, 12) }, // 0x1899 {0, RF_TxPowerTable_DEFAULT_PA_ENTRY(29, 1, 0, 22) }, // 0x2C5D {1, RF_TxPowerTable_DEFAULT_PA_ENTRY(33, 1, 0, 25) }, // 0x3261 {2, RF_TxPowerTable_DEFAULT_PA_ENTRY(38, 1, 0, 31) }, // 0x3E66 {3, RF_TxPowerTable_DEFAULT_PA_ENTRY(47, 1, 0, 36) }, // 0x486F {4, RF_TxPowerTable_DEFAULT_PA_ENTRY(32, 0, 0, 65) }, // 0x8220 {5, RF_TxPowerTable_DEFAULT_PA_ENTRY(46, 0, 0, 59) }, // 0x762E {14, RF_TxPowerTable_HIGH_PA_ENTRY(22, 3, 1, 19, 27) }, // 0x1B27D6 {15, RF_TxPowerTable_HIGH_PA_ENTRY(26, 3, 1, 23, 27) }, // 0x1B2FDA {16, RF_TxPowerTable_HIGH_PA_ENTRY(30, 3, 1, 28, 27) }, // 0x1B39DE {17, RF_TxPowerTable_HIGH_PA_ENTRY(37, 3, 1, 39, 27) }, // 0x1B4FE5 {18, RF_TxPowerTable_HIGH_PA_ENTRY(32, 3, 1, 35, 48) }, // 0x3047E0 {19, RF_TxPowerTable_HIGH_PA_ENTRY(34, 3, 1, 48, 63) }, // 0x3F61E2 {20, RF_TxPowerTable_HIGH_PA_ENTRY(53, 3, 1, 58, 63) }, // 0x3F75F5 RF_TxPowerTable_TERMINATION_ENTRY }; //********************************************************************************* // RF Setting: BLE, 2 Mbps, LE 2M, 10 dBm // // PHY: bt5le2mp10 // Setting file: setting_bt5_le_2m_10_dbm.json //********************************************************************************* // PARAMETER SUMMARY // NB! Setting RF parameters in this design has no effect as no RF commands are selected. // TI-RTOS RF Mode Object RF_Mode RF_modeBle = { .rfMode = RF_MODE_AUTO, .cpePatchFxn = &amp;rf_patch_cpe_multi_bt5_coex, .mcePatchFxn = &amp;rf_patch_mce_bt5, .rfePatchFxn = &amp;rf_patch_rfe_ble_coex }; // Overrides for CMD_BLE5_RADIO_SETUP_PA uint32_t pOverrides_bleCommon[] = { // override_ble5_setup_override_common_10_dbm.json // Bluetooth 5: Set pilot tone length to 35 us HW_REG_OVERRIDE(0x6024,0x5B20), // Bluetooth 5: Compensate for 35 us pilot tone length (uint32_t)0x01640263, // Synth: Increase mid code calibration time to 5 us (uint32_t)0x00058683, // Synth: Increase mid code calibration time to 5 us HW32_ARRAY_OVERRIDE(0x4004,0x0001), // Synth: Increase mid code calibration time to 5 us (uint32_t)0x38183C30, // Bluetooth 5: Default to no CTE. HW_REG_OVERRIDE(0x5328,0x0000), // Synth: Set calibration fine point code to 60 (default: 64) HW_REG_OVERRIDE(0x4064,0x003C), // Bluetooth 5: Set DTX threshold 1 Mbps (uint32_t)0x00950803, // Bluetooth 5: Set DTX threshold 2 Mbps (uint32_t)0x012A0823, // Bluetooth 5: Set DTX gain -5% for 1 Mbps (uint32_t)0x00E787E3, // Bluetooth 5: Set DTX gain -2.5% for 2 Mbps (uint32_t)0x00F487F3, // Bluetooth 5: Set synth fine code calibration interval HW32_ARRAY_OVERRIDE(0x4020,0x0001), // Bluetooth 5: Set synth fine code calibration interval (uint32_t)0x41005F00, // Bluetooth 5: Adapt to synth fine code calibration interval (uint32_t)0xC0040141, // Bluetooth 5: Adapt to synth fine code calibration interval (uint32_t)0x0007DD44, // Set VCTRIM to 0 for 20 dBm PA ADI_HALFREG_OVERRIDE(1,26,0xF,0x0), // Set VCTRIM to 0 for 20 dBm PA ADI_HALFREG_OVERRIDE(1,27,0x7,0x0), // Rx: Set RSSI offset to adjust reported RSSI by -1 dB (uint32_t)0x000188A3, // override_ble5_coex.json // CoEx: set the radio IOMUX to enable coex signals HW_REG_OVERRIDE(0x1110,0xCE30), // CoEx: Enable CoEx (uint32_t)0x000188F3, // CoEx: Enable 32 bit write for the pointer (uint32_t)0xC0040371, // CoEx: Place the pointer to the configuration struct at byte index 220 (uint32_t)&amp;coexConfig, // ti/ble5stack/icall/inc/ble_overrides.h BLE_STACK_OVERRIDES(), (uint32_t)0xFFFFFFFF }; // Overrides for CMD_BLE5_RADIO_SETUP_PA uint32_t pOverrides_ble1Mbps[] = { // override_ble5_setup_override_1mbps_coex.json // PHY: Use MCE ROM, RFE RAM MCE_RFE_OVERRIDE(0,3,0,1,0,0), // override_ble5_setup_override_1mbps_10_dbm.json // Bluetooth 5: Set pilot tone length to 35 us HW_REG_OVERRIDE(0x5320,0x690), // Bluetooth 5: Compensate for modified pilot tone length (uint32_t)0x018F02A3, // override_ble5_symbol_error_tracking.json // Symbol tracking: timing correction HW_REG_OVERRIDE(0x50D4,0x00F9), // Symbol tracking: reduce sample delay HW_REG_OVERRIDE(0x50E0,0x0087), // Symbol tracking: demodulation order HW_REG_OVERRIDE(0x50F8,0x0014), (uint32_t)0xFFFFFFFF }; // Overrides for CMD_BLE5_RADIO_SETUP_PA uint32_t pOverrides_ble2Mbps[] = { // override_ble5_setup_override_2mbps_coex_residual_per.json // PHY: Use MCE RAM patch (mode 2), RFE RAM patch (mode 2) MCE_RFE_OVERRIDE(1,0,2,1,0,2), // Rx: increase AGC hysteresis (HIGH_GAIN=15, LOW_GAIN=11) HW_REG_OVERRIDE(0x6098,0x75FB), // override_ble5_setup_override_2mbps_10_dbm.json // Bluetooth 5: increase low gain AGC delay for 2 Mbps HW_REG_OVERRIDE(0x60A4,0x7D00), // Bluetooth 5: Set pilot tone length to 35 us HW_REG_OVERRIDE(0x5320,0x690), // Bluetooth 5: Compensate for modified pilot tone length (uint32_t)0x012D02A3, // override_ble5_symbol_error_tracking.json // Symbol tracking: timing correction HW_REG_OVERRIDE(0x50D4,0x00F9), // Symbol tracking: reduce sample delay HW_REG_OVERRIDE(0x50E0,0x0087), // Symbol tracking: demodulation order HW_REG_OVERRIDE(0x50F8,0x0014), (uint32_t)0xFFFFFFFF }; // Overrides for CMD_BLE5_RADIO_SETUP_PA uint32_t pOverrides_bleCoded[] = { // override_ble5_setup_override_coded_coex.json // PHY: Use MCE ROM, RFE RAM MCE_RFE_OVERRIDE(0,3,1,1,0,1), // override_ble5_setup_override_coded_10_dbm.json // Bluetooth 5: Set pilot tone length to 35 us HW_REG_OVERRIDE(0x5320,0x690), // Bluetooth 5: Compensate for modified pilot tone length (uint32_t)0x07E502A3, // Bluetooth 5: Set AGC mangnitude target to 0x21. HW_REG_OVERRIDE(0x609C,0x0021), (uint32_t)0xFFFFFFFF }; // Overrides for CMD_BLE5_RADIO_SETUP_PA uint32_t pOverrides_bleTxStd[] = { // override_txstd_placeholder.json // TX Standard power override TX_STD_POWER_OVERRIDE(0x762E), // The ANADIV radio parameter based on LO divider and front end settings (uint32_t)0x05320703, // override_txstd_settings.json // Bluetooth 5: Set RTIM offset to default for standard PA (uint32_t)0x00008783, // Bluetooth 5: Set synth mux to default value for standard PA (uint32_t)0x050206C3, // Set TXRX pin to 0 in RX and high impedance in idle/TX HW_REG_OVERRIDE(0x60A8,0x0401), // Bluetooth 5: Set DTX gain -5% for 1 Mbps (uint32_t)0x00E787E3, // Bluetooth 5: Set DTX gain -2.5% for 2 Mbps (uint32_t)0x00F487F3, // Bluetooth 5: Set enhanced TX shape (uint32_t)0x000D8C73, (uint32_t)0xFFFFFFFF }; // Overrides for CMD_BLE5_RADIO_SETUP_PA uint32_t pOverrides_bleTx20[] = { // override_tx20_placeholder.json // TX HighPA power override TX20_POWER_OVERRIDE(0x00103F5F), // The ANADIV radio parameter based on LO divider and front end settings (uint32_t)0x01C20703, // override_tx10dbm_settings.json // Bluetooth 5: Set IPEAK = 7 and DCDC dither off for TX (uint32_t)0x00F788D3, // Bluetooth 5: Set enhanced TX shape (uint32_t)0x000D8C73, // Bluetooth 5: Set RTIM offset to 3 for high power PA (uint32_t)0x00030783, // Bluetooth 5: Set synth mux for high power PA (uint32_t)0x010206C3, // Bluetooth 5: Set TXRX pin to 0 in RX/TX and high impedance in idle HW_REG_OVERRIDE(0x60A8,0x0001), (uint32_t)0xFFFFFFFF }; 分析此段代码的主要作用是
10-14
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值