]> sigrok.org Git - libsigrok.git/blobdiff - hardware/common/dmm/fs9721.c
fs9721: Factor out common code from serial-dmm.
[libsigrok.git] / hardware / common / dmm / fs9721.c
index 41b08f713e7bb0bc133f3743c6f9f7be312bc2e0..17a03a62647faf068dc577e91b2306b6fffd2868 100644 (file)
@@ -326,11 +326,6 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
                sr_spew("User-defined LCD symbol 3 is active.");
 }
 
-SR_PRIV gboolean sr_fs9721_is_packet_start(uint8_t b)
-{
-       return (((b >> 4) & 0x0f) == 0x01);
-}
-
 SR_PRIV gboolean sr_fs9721_packet_valid(const uint8_t *buf)
 {
        struct fs9721_info info;
@@ -373,3 +368,61 @@ SR_PRIV int sr_fs9721_parse(const uint8_t *buf, float *floatval,
 
        return SR_OK;
 }
+
+SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog *analog, void *info)
+{
+       struct fs9721_info *info_local;
+
+       info_local = (struct fs9721_info *)info;
+
+       /* User-defined FS9721_LP3 flag 'c2c1_00' means temperature (C). */
+       if (info_local->is_c2c1_00) {
+               analog->mq = SR_MQ_TEMPERATURE;
+               analog->unit = SR_UNIT_CELSIUS;
+       }
+}
+
+SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog *analog, void *info)
+{
+       struct fs9721_info *info_local;
+
+       info_local = (struct fs9721_info *)info;
+
+       /* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (C). */
+       if (info_local->is_c2c1_01) {
+               analog->mq = SR_MQ_TEMPERATURE;
+               analog->unit = SR_UNIT_CELSIUS;
+       }
+}
+
+SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog *analog, void *info)
+{
+       struct fs9721_info *info_local;
+
+       info_local = (struct fs9721_info *)info;
+
+       /* User-defined FS9721_LP3 flag 'c2c1_10' means temperature (C). */
+       if (info_local->is_c2c1_10) {
+               analog->mq = SR_MQ_TEMPERATURE;
+               analog->unit = SR_UNIT_CELSIUS;
+       }
+}
+
+SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *info)
+{
+       struct fs9721_info *info_local;
+
+       info_local = (struct fs9721_info *)info;
+
+       /* User-defined FS9721_LP3 flag 'c2c1_01' means temperature (F). */
+       if (info_local->is_c2c1_01) {
+               analog->mq = SR_MQ_TEMPERATURE;
+               analog->unit = SR_UNIT_FAHRENHEIT;
+       }
+
+       /* User-defined FS9721_LP3 flag 'c2c1_10' means temperature (C). */
+       if (info_local->is_c2c1_10) {
+               analog->mq = SR_MQ_TEMPERATURE;
+               analog->unit = SR_UNIT_CELSIUS;
+       }
+}