当前位置: 首页>>代码示例>>C++>>正文


C++ ECHECK函数代码示例

本文整理汇总了C++中ECHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ ECHECK函数的具体用法?C++ ECHECK怎么用?C++ ECHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ECHECK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: acq_SetChannelThreshold

int acq_SetChannelThreshold(rp_channel_t channel, float voltage)
{
    float gainV;
    rp_pinState_t gain;

    ECHECK(acq_GetGainV(channel, &gainV));
    ECHECK(acq_GetGain(channel, &gain));;

    if (fabs(voltage) - fabs(gainV) > FLOAT_EPS) {
        return RP_EOOR;
    }

    rp_calib_params_t calib = calib_GetParams();
    int32_t dc_offs = (channel == RP_CH_1 ? calib.fe_ch1_dc_offs : calib.fe_ch2_dc_offs);
    uint32_t calibScale = calib_GetFrontEndScale(channel, gain);

    uint32_t cnt = cmn_CnvVToCnt(ADC_BITS, voltage, gainV, gain == RP_HIGH ? false : true, calibScale, dc_offs, 0.0);

    // We cut high bits of negative numbers
    cnt = cnt & ((1 << ADC_BITS) - 1);

    if (channel == RP_CH_1) {
        return osc_SetThresholdChA(cnt);
    }
    else {
        return osc_SetThresholdChB(cnt);
    }
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:28,代码来源:acq_handler.c

示例2: acq_SetTriggerLevel

int acq_SetTriggerLevel(float voltage)
{
    if ((last_trig_src == RP_TRIG_SRC_CHA_PE) || (last_trig_src == RP_TRIG_SRC_CHA_NE)) {
        ECHECK(acq_SetChannelThreshold(RP_CH_1, voltage));
    } else if ((last_trig_src == RP_TRIG_SRC_CHB_PE) || (last_trig_src == RP_TRIG_SRC_CHB_NE)) {
        ECHECK(acq_SetChannelThreshold(RP_CH_2, voltage));
    }
    return RP_OK;
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:9,代码来源:acq_handler.c

示例3: acq_GetTriggerHyst

int acq_GetTriggerHyst(float *voltage)
{
    if ((last_trig_src == RP_TRIG_SRC_CHA_PE) || (last_trig_src == RP_TRIG_SRC_CHA_NE)) {
        ECHECK(acq_GetChannelThresholdHyst(RP_CH_1, voltage));
    } else if ((last_trig_src == RP_TRIG_SRC_CHA_PE) || (last_trig_src == RP_TRIG_SRC_CHA_NE)) {
        ECHECK(acq_GetChannelThresholdHyst(RP_CH_2, voltage));
    }
    return RP_OK;
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:9,代码来源:acq_handler.c

示例4: acq_GetTriggerDelayNs

int acq_GetTriggerDelayNs(int64_t* time_ns)
{
    int32_t samples;
    ECHECK(acq_GetTriggerDelay(&samples));
    *time_ns=cnvSmplsToTime(samples);
    return RP_OK;
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:7,代码来源:acq_handler.c

示例5: acq_SetTriggerDelayNs

int acq_SetTriggerDelayNs(int64_t time_ns, bool updateMaxValue)
{
    int32_t samples = cnvTimeToSmpls(time_ns);
    ECHECK(acq_SetTriggerDelay(samples, updateMaxValue));
    triggerDelayInNs = true;
    return RP_OK;
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:7,代码来源:acq_handler.c

示例6: acq_GetSamplingRateHz

int acq_GetSamplingRateHz(float* sampling_rate)
{
    float max_rate = 125000000.0f;

    rp_acq_decimation_t decimation;
    ECHECK(acq_GetDecimation(&decimation));

    switch(decimation){
        case RP_DEC_1:
            *sampling_rate = max_rate / 1;
            break;
        case RP_DEC_8:
            *sampling_rate = max_rate / 8;
            break;
        case RP_DEC_64:
            *sampling_rate = max_rate / 64;
            break;
        case RP_DEC_1024:
            *sampling_rate = max_rate / 1024;
            break;
        case RP_DEC_8192:
            *sampling_rate = max_rate / 8192;
            break;
        case RP_DEC_65536:
            *sampling_rate = max_rate / 65536;
            break;
    }

    return RP_OK;
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:30,代码来源:acq_handler.c

示例7: acq_GetSamplingRate

int acq_GetSamplingRate(rp_acq_sampling_rate_t* sampling_rate)
{
    rp_acq_decimation_t decimation;
    ECHECK(acq_GetDecimation(&decimation));

    switch (decimation) {
    case RP_DEC_1:
        *sampling_rate = RP_SMP_125M;
        return RP_OK;
    case RP_DEC_8:
        *sampling_rate = RP_SMP_15_625M;
        return RP_OK;
    case RP_DEC_64:
        *sampling_rate = RP_SMP_1_953M;
        return RP_OK;
    case RP_DEC_1024:
        *sampling_rate = RP_SMP_122_070K;
        return RP_OK;
    case RP_DEC_8192:
        *sampling_rate = RP_SMP_15_258K;
        return RP_OK;
    case RP_DEC_65536:
        *sampling_rate = RP_SMP_1_907K;
        return RP_OK;
    default:
        return RP_EOOR;
    }
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:28,代码来源:acq_handler.c

示例8: acq_GetDecimationFactor

int acq_GetDecimationFactor(uint32_t* decimation)
{
    rp_acq_decimation_t decimationVal;
    ECHECK(acq_GetDecimation(&decimationVal));

    switch (decimationVal) {
    case RP_DEC_1:
        *decimation = DEC_1;
        return RP_OK;
    case RP_DEC_8:
        *decimation = DEC_8;
        return RP_OK;
    case RP_DEC_64:
        *decimation = DEC_64;
        return RP_OK;
    case RP_DEC_1024:
        *decimation = DEC_1024;
        return RP_OK;
    case RP_DEC_8192:
        *decimation = DEC_8192;
        return RP_OK;
    case RP_DEC_65536:
        *decimation = DEC_65536;
        return RP_OK;
    default:
        return RP_EOOR;
    }
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:28,代码来源:acq_handler.c

示例9: acq_GetDecimation

int acq_GetDecimation(rp_acq_decimation_t* decimation)
{
    uint32_t decimationVal;
    ECHECK(osc_GetDecimation(&decimationVal));

    if (decimationVal == DEC_1) {
        *decimation = RP_DEC_1;
        return RP_OK;
    }
    else if (decimationVal == DEC_8) {
        *decimation = RP_DEC_8;
        return RP_OK;
    }
    else if (decimationVal == DEC_64) {
        *decimation = RP_DEC_64;
        return RP_OK;
    }
    else if (decimationVal == DEC_1024) {
        *decimation = RP_DEC_1024;
        return RP_OK;
    }
    else if (decimationVal == DEC_8192) {
        *decimation = RP_DEC_8192;
        return RP_OK;
    }
    else if (decimationVal == DEC_65536) {
        *decimation = RP_DEC_65536;
        return RP_OK;
    }
    else {
        return RP_EOOR;
    }
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:33,代码来源:acq_handler.c

示例10: generate_Init

int generate_Init() {
//  ECHECK(cmn_Init());
    ECHECK(cmn_Map(GENERATE_BASE_SIZE, GENERATE_BASE_ADDR, (void **) &generate));
    data_chA = (int32_t *) ((char *) generate + (CHA_DATA_OFFSET));
    data_chB = (int32_t *) ((char *) generate + (CHB_DATA_OFFSET));
    return RP_OK;
}
开发者ID:1nfused,项目名称:RemoteAccess,代码行数:7,代码来源:generate.c

示例11: generate_Release

int generate_Release() {
    ECHECK(cmn_Unmap(GENERATE_BASE_SIZE, (void **) &generate));
//  ECHECK(cmn_Release());
    data_chA = NULL;
    data_chB = NULL;
    return RP_OK;
}
开发者ID:1nfused,项目名称:RemoteAccess,代码行数:7,代码来源:generate.c

示例12: cnvSmplsToTime

/**
 * @brief Converts ADC samples to time in [ns]
 *
 *
 * @param[in] samples, number of ADC samples
 * @retval int time, specified in [ns]
 */
static int64_t cnvSmplsToTime(int32_t samples)
{
    /* Calculate time (including decimation) */

    uint32_t decimation;
    ECHECK(acq_GetDecimationFactor(&decimation));

    return (int64_t)samples * ADC_SAMPLE_PERIOD * (int32_t)decimation;
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:16,代码来源:acq_handler.c

示例13: acq_GetOldestDataV

/**
 * Use only when write pointer has stopped...
 */
int acq_GetOldestDataV(rp_channel_t channel, uint32_t* size, float* buffer)
{
    uint32_t pos;

    ECHECK(acq_GetWritePointer(&pos));
    pos++;

    return acq_GetDataV(channel, pos, size, buffer);
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:12,代码来源:acq_handler.c

示例14: cnvTimeToSmpls

/**
 * @brief Converts time in [ns] to ADC samples
 *
 *
 * @param[in] time time, specified in [ns]
 * @retval int number of ADC samples
 */
static uint32_t cnvTimeToSmpls(int64_t time_ns)
{
    /* Calculate sampling period (including decimation) */

    uint32_t decimation;
    ECHECK(acq_GetDecimationFactor(&decimation));

    int64_t smpl_p = (ADC_SAMPLE_PERIOD * (int64_t)decimation);
    return (int32_t)round((double)time_ns / smpl_p);
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:17,代码来源:acq_handler.c

示例15: acq_SetGain

int acq_SetGain(rp_channel_t channel, rp_pinState_t state)
{

    rp_pinState_t *gain = NULL;

    if (channel == RP_CH_1) {
        gain = &gain_ch_a;
    }

    else {
        gain = &gain_ch_b;
    }

    // Read old values which are dependent on the gain...
    rp_pinState_t old_gain;
    float ch_thr, ch_hyst;
    old_gain = *gain;
    ECHECK(acq_GetChannelThreshold(channel, &ch_thr));
    ECHECK(acq_GetChannelThresholdHyst(channel, &ch_hyst));

    // Now update the gain
    *gain = state;

    // And recalculate new values...
    int status = acq_SetChannelThreshold(channel, ch_thr);
    if (status == RP_OK) {
        status = acq_SetChannelThresholdHyst(channel, ch_hyst);
    }

    // In case of an error, put old values back and report the error
    if (status != RP_OK) {
        *gain = old_gain;
        acq_SetChannelThreshold(channel, ch_thr);
        acq_SetChannelThresholdHyst(channel, ch_hyst);
    }
    // At the end if everything is ok, update also equalization filters based on the new gain.
    // Updating eq filters should never fail...
    else {
        status = setEqFilters(channel);
    }

    return status;
}
开发者ID:abayerle1,项目名称:RedPitaya,代码行数:43,代码来源:acq_handler.c


注:本文中的ECHECK函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。