本文整理匯總了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);
}
}
示例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;
}
示例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;
}
示例4: acq_GetTriggerDelayNs
int acq_GetTriggerDelayNs(int64_t* time_ns)
{
int32_t samples;
ECHECK(acq_GetTriggerDelay(&samples));
*time_ns=cnvSmplsToTime(samples);
return RP_OK;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}