struct sr_analog_meaning meaning;
struct sr_analog_spec spec;
GSList *channels;
+ float scale_factor;
};
SR_API struct feed_queue_analog *feed_queue_analog_alloc(
return q;
}
+SR_API int feed_queue_analog_params(struct feed_queue_analog *q,
+ float scale_factor,
+ enum sr_mq mq, enum sr_mqflag mq_flag, enum sr_unit unit)
+{
+ int ret;
+
+ if (!q)
+ return SR_ERR_ARG;
+
+ ret = feed_queue_analog_flush(q);
+ if (ret != SR_OK)
+ return ret;
+
+ q->scale_factor = scale_factor;
+ if (q->scale_factor == 1.0)
+ q->scale_factor = 0.0;
+
+ q->meaning->mq = mq;
+ q->meaning->mqflags = mqflags;
+ q->meaning->unit = unit;
+
+ return SR_OK;
+}
+
SR_API int feed_queue_analog_submit(struct feed_queue_analog *q,
float data, size_t count)
{
int ret;
+ if (q->scale_factor)
+ data *= q->scale_factor;
while (count--) {
q->data_values[q->fill_count++] = data;
if (q->fill_count == q->alloc_count) {
SR_API struct feed_queue_analog *feed_queue_analog_alloc(
const struct sr_dev_inst *sdi,
size_t sample_count, int digits, struct sr_channel *ch);
+SR_API int feed_queue_analog_params(struct feed_queue_analog *q,
+ float scale_factor,
+ enum sr_mq mq, enum sr_mqflag mq_flag, enum sr_unit unit);
SR_API int feed_queue_analog_submit(struct feed_queue_analog *q,
float data, size_t count);
SR_API int feed_queue_analog_flush(struct feed_queue_analog *q);