sr: add support for pulse width measurements

This commit is contained in:
Bert Vermeulen 2012-09-25 18:33:42 +02:00
parent f46a36ad80
commit aa839a5c4f
2 changed files with 5 additions and 0 deletions

View File

@ -146,6 +146,7 @@ enum {
SR_MQ_FREQUENCY, SR_MQ_FREQUENCY,
SR_MQ_DUTY_CYCLE, SR_MQ_DUTY_CYCLE,
SR_MQ_CONTINUITY, SR_MQ_CONTINUITY,
SR_MQ_PULSE_WIDTH,
}; };
/* sr_datafeed_analog.unit values */ /* sr_datafeed_analog.unit values */
@ -160,6 +161,7 @@ enum {
SR_UNIT_HERTZ, SR_UNIT_HERTZ,
SR_UNIT_PERCENTAGE, SR_UNIT_PERCENTAGE,
SR_UNIT_BOOLEAN, SR_UNIT_BOOLEAN,
SR_UNIT_SECOND,
}; };
/** sr_datafeed_analog.flags values */ /** sr_datafeed_analog.flags values */

View File

@ -125,6 +125,9 @@ static void fancyprint(int unit, int mqflags, float value, GString *out)
else else
g_string_append_printf(out, "FALSE"); g_string_append_printf(out, "FALSE");
break; break;
case SR_UNIT_SECOND:
si_printf(value, out, "s");
break;
} }
if (mqflags & SR_MQFLAG_AC) if (mqflags & SR_MQFLAG_AC)
g_string_append_printf(out, " AC"); g_string_append_printf(out, " AC");