/** * 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); }
/** * Use only when write pointer has stopped... */ int acq_GetOldestDataRaw(rp_channel_t channel, uint32_t* size, int16_t* buffer) { uint32_t pos; acq_GetWritePointer(&pos); pos++; return acq_GetDataRaw(channel, pos, size, buffer); }
int acq_GetLatestDataV(rp_channel_t channel, uint32_t* size, float* buffer) { *size = MIN(*size, ADC_BUFFER_SIZE); uint32_t pos; ECHECK(acq_GetWritePointer(&pos)); pos = (pos - (*size)) % ADC_BUFFER_SIZE; return acq_GetDataV(channel, pos, size, buffer); }
int acq_GetLatestDataRaw(rp_channel_t channel, uint32_t* size, int16_t* buffer) { *size = MIN(*size, ADC_BUFFER_SIZE); uint32_t pos; ECHECK(acq_GetWritePointer(&pos)); pos++; if ((*size) > pos) { pos += ADC_BUFFER_SIZE; } pos -= (*size); return acq_GetDataRaw(channel, pos, size, buffer); }