]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/rdtech-tc/protocol.c
rdtech-tc: eliminate excessive indentation, address whitespace issues
[libsigrok.git] / src / hardware / rdtech-tc / protocol.c
index 456681ea49d6e7766db9b972dcd380f70a89a61d..46d0e83e0510d301071707e4ce8c1e539436d076 100644 (file)
  */
 
 #include <config.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
+
 #include <glib.h>
-#include <nettle/aes.h>
 #include <libsigrok/libsigrok.h>
+#include <math.h>
+#include <nettle/aes.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include "libsigrok-internal.h"
 #include "protocol.h"
 
@@ -71,7 +73,7 @@ static const struct binary_analog_channel rdtech_tc_channels[] = {
        { "D-", {  64 + 36, BVT_LE_UINT32, 1e-2, }, 2, SR_MQ_VOLTAGE, SR_UNIT_VOLT },
        { "E0", {  64 + 12, BVT_LE_UINT32, 1e-3, }, 3, SR_MQ_ENERGY, SR_UNIT_WATT_HOUR },
        { "E1", {  64 + 20, BVT_LE_UINT32, 1e-3, }, 3, SR_MQ_ENERGY, SR_UNIT_WATT_HOUR },
-       { NULL, },
+       ALL_ZERO,
 };
 
 static int check_pac_crc(uint8_t *data)
@@ -91,7 +93,7 @@ static int check_pac_crc(uint8_t *data)
        }
 }
 
-static int process_poll_pkt(struct dev_context  *devc, uint8_t *dst)
+static int process_poll_pkt(struct dev_context *devc, uint8_t *dst)
 {
        struct aes256_ctx ctx;
 
@@ -115,13 +117,13 @@ static int process_poll_pkt(struct dev_context  *devc, uint8_t *dst)
        return SR_OK;
 }
 
-SR_PRIV int rdtech_tc_probe(struct sr_serial_dev_inst *serial, struct dev_context  *devc)
+SR_PRIV int rdtech_tc_probe(struct sr_serial_dev_inst *serial, struct dev_context *devc)
 {
        int len;
        uint8_t poll_pkt[TC_POLL_LEN];
 
        if (serial_write_blocking(serial, &POLL_CMD, sizeof(POLL_CMD) - 1,
-                                  SERIAL_WRITE_TIMEOUT_MS) < 0) {
+                       SERIAL_WRITE_TIMEOUT_MS) < 0) {
                sr_err("Unable to send probe request.");
                return SR_ERR;
        }
@@ -151,7 +153,7 @@ SR_PRIV int rdtech_tc_poll(const struct sr_dev_inst *sdi)
        struct sr_serial_dev_inst *serial = sdi->conn;
 
        if (serial_write_blocking(serial, &POLL_CMD, sizeof(POLL_CMD) - 1,
-                                  SERIAL_WRITE_TIMEOUT_MS) < 0) {
+                       SERIAL_WRITE_TIMEOUT_MS) < 0) {
                sr_err("Unable to send poll request.");
                return SR_ERR;
        }
@@ -181,8 +183,8 @@ static void handle_poll_data(const struct sr_dev_inst *sdi)
 
        for (ch = sdi->channels, i = 0; ch; ch = g_slist_next(ch), i++) {
                bv_send_analog_channel(sdi, ch->data,
-                                      &devc->channels[i], poll_pkt, TC_POLL_LEN);
-        }
+                       &devc->channels[i], poll_pkt, TC_POLL_LEN);
+       }
 
        sr_sw_limits_update_samples_read(&devc->limits, 1);
 }