int acq_GetTriggerLevel(float *voltage) { if ((last_trig_src == RP_TRIG_SRC_CHA_PE) || (last_trig_src == RP_TRIG_SRC_CHA_NE)) { ECHECK(acq_GetChannelThreshold(RP_CH_1, voltage)); } else if ((last_trig_src == RP_TRIG_SRC_CHB_PE) || (last_trig_src == RP_TRIG_SRC_CHB_NE)) { ECHECK(acq_GetChannelThreshold(RP_CH_2, voltage)); } return RP_OK; }
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; }
int acq_GetTriggerLevel(float *voltage) { ECHECK(acq_GetChannelThreshold(RP_CH_1, voltage)); return RP_OK; }