SR_ERR_DATA =-10, /**< Data is invalid. */
SR_ERR_IO =-11, /**< Input/output error. */
- /*
- * Note: When adding entries here, don't forget to also update the
- * sr_strerror() and sr_strerror_name() functions in error.c.
- */
+ /* Update sr_strerror()/sr_strerror_name() (error.c) upon changes! */
};
#define SR_MAX_CHANNELNAME_LEN 32
SR_T_DOUBLE_RANGE,
SR_T_INT32,
SR_T_MQLIST,
+
+ /* Update sr_variant_type_get() (hwdriver.c) upon changes! */
};
/** Value for sr_datafeed_packet.type. */
SR_DF_FRAME_END,
/** Payload is struct sr_datafeed_analog2. */
SR_DF_ANALOG2,
+
+ /* Update datafeed_dump() (session.c) upon changes! */
};
/** Measured quantity, sr_datafeed_analog.mq. */
SR_MQ_APPARENT_POWER,
/** Mass */
SR_MQ_MASS,
+
+ /* Update sr_key_info_mq[] (hwdriver.c) upon changes! */
};
/** Unit of measured quantity, sr_datafeed_analog.unit. */
SR_UNIT_TOLA,
/** Pieces (number of items). */
SR_UNIT_PIECE,
+
+ /*
+ * Update unit_strings[] (analog.c) and fancyprint() (output/analog.c)
+ * upon changes!
+ */
};
/** Values for sr_datafeed_analog.flags. */
SR_MQFLAG_REFERENCE = 0x80000,
/** Unstable value (hasn't settled yet). */
SR_MQFLAG_UNSTABLE = 0x100000,
+
+ /*
+ * Update mq_strings[] (analog.c) and fancyprint() (output/analog.c)
+ * upon changes!
+ */
};
enum sr_trigger_matches {
/** The device can act as a scale. */
SR_CONF_SCALE,
+ /* Update sr_key_info_config[] (hwdriver.c) upon changes! */
+
/*--- Driver scan options -------------------------------------------*/
/**
*/
SR_CONF_MODBUSADDR,
+ /* Update sr_key_info_config[] (hwdriver.c) upon changes! */
+
/*--- Device (or channel group) configuration -----------------------*/
/** The device supports setting its samplerate, in Hz. */
/** Over-temperature protection (OTP) active. */
SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE,
+ /* Update sr_key_info_config[] (hwdriver.c) upon changes! */
+
/*--- Special stuff -------------------------------------------------*/
/** Scan options supported by the driver. */
/** The device supports setting a probe factor. */
SR_CONF_PROBE_FACTOR,
+ /* Update sr_key_info_config[] (hwdriver.c) upon changes! */
+
/*--- Acquisition modes, sample limiting ----------------------------*/
/**
/** Self test mode. */
SR_CONF_TEST_MODE,
+
+ /* Update sr_key_info_config[] (hwdriver.c) upon changes! */
};
/**
char *str;
};
+/* Please use the same order as in enum sr_unit (libsigrok.h). */
static struct unit_mq_string unit_strings[] = {
{ SR_UNIT_VOLT, "V" },
{ SR_UNIT_AMPERE, "A" },
ALL_ZERO
};
+/* Please use the same order as in enum sr_mqflag (libsigrok.h). */
static struct unit_mq_string mq_strings[] = {
{ SR_MQFLAG_AC, " AC" },
{ SR_MQFLAG_DC, " DC" },
* @{
*/
-/* Same key order/grouping as in enum sr_configkey (libsigrok.h). */
+/* Please use the same order/grouping as in enum sr_configkey (libsigrok.h). */
static struct sr_key_info sr_key_info_config[] = {
/* Device classes */
{SR_CONF_LOGIC_ANALYZER, SR_T_STRING, NULL, "Logic analyzer", NULL},
{0, 0, NULL, NULL, NULL},
};
+/* Please use the same order as in enum sr_mq (libsigrok.h). */
static struct sr_key_info sr_key_info_mq[] = {
{SR_MQ_VOLTAGE, 0, "voltage", "Voltage", NULL},
{SR_MQ_CURRENT, 0, "current", "Current", NULL},
ALL_ZERO
};
+/* Please use the same order as in enum sr_mqflag (libsigrok.h). */
static struct sr_key_info sr_key_info_mqflag[] = {
{SR_MQFLAG_AC, 0, "ac", "AC", NULL},
{SR_MQFLAG_DC, 0, "dc", "DC", NULL},
ALL_ZERO
};
+/* This must handle all the keys from enum sr_datatype (libsigrok.h). */
SR_PRIV const GVariantType *sr_variant_type_get(int datatype)
{
switch (datatype) {
}
+/* Please use the same order as in enum sr_unit (libsigrok.h). */
static void fancyprint(int unit, int mqflags, float value, GString *out)
{
switch (unit) {
break;
}
+ /* Please use the same order as in enum sr_mqflag (libsigrok.h). */
if (mqflags & SR_MQFLAG_AC)
g_string_append_printf(out, " AC");
if (mqflags & SR_MQFLAG_DC)
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog2 *analog2;
+ /* Please use the same order as in libsigrok.h. */
switch (packet->type) {
case SR_DF_HEADER:
sr_dbg("bus: Received SR_DF_HEADER packet.");