From: Aurelien Jacobs Date: Thu, 10 Oct 2013 20:28:35 +0000 (+0200) Subject: add energy meter device type and related units X-Git-Tag: libsigrok-0.2.2~33 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=45315d0460aa9d66b520f80dbd0dee66e48df12d add energy meter device type and related units --- diff --git a/libsigrok.h b/libsigrok.h index 67f31971..17d7fc17 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -217,6 +217,9 @@ enum { */ SR_UNIT_CONCENTRATION, SR_UNIT_REVOLUTIONS_PER_MINUTE, + SR_UNIT_VOLT_AMPERE, + SR_UNIT_WATT, + SR_UNIT_WATT_HOUR, }; /** Values for sr_datafeed_analog.flags. */ @@ -583,6 +586,9 @@ enum { /** The device can measure humidity. */ SR_CONF_HYGROMETER, + /** The device can measure energy consumption. */ + SR_CONF_ENERGYMETER, + /*--- Driver scan options -------------------------------------------*/ /** diff --git a/output/analog.c b/output/analog.c index 74376639..50189b41 100644 --- a/output/analog.c +++ b/output/analog.c @@ -175,6 +175,14 @@ static void fancyprint(int unit, int mqflags, float value, GString *out) break; case SR_UNIT_REVOLUTIONS_PER_MINUTE: si_printf(value, out, "RPM"); + case SR_UNIT_VOLT_AMPERE: + si_printf(value, out, "VA"); + break; + case SR_UNIT_WATT: + si_printf(value, out, "W"); + break; + case SR_UNIT_WATT_HOUR: + si_printf(value, out, "Wh"); break; default: si_printf(value, out, "");