]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/korad-kdxxxxp/protocol.c
Constify a lot more items.
[libsigrok.git] / src / hardware / korad-kdxxxxp / protocol.c
index bee02d9d5324c4bd164859c5facb409490def777..bec63b4e40c5ad375a30e262ac5eebf6053b93ec 100644 (file)
@@ -80,7 +80,8 @@ static void give_device_time_to_process(struct dev_context *devc)
 SR_PRIV int korad_kdxxxxp_set_value(struct sr_serial_dev_inst *serial,
                                struct dev_context *devc)
 {
-       char msg[21], *cmd;
+       char msg[21];
+       const char *cmd;
        float value;
        int ret;
 
@@ -111,11 +112,11 @@ SR_PRIV int korad_kdxxxxp_set_value(struct sr_serial_dev_inst *serial,
                break;
        case KDXXXXP_OCP:
                cmd = "OCP%01.0f";
-               value = (devc->OCP_enabled) ? 1 : 0;
+               value = (devc->ocp_enabled) ? 1 : 0;
                break;
        case KDXXXXP_OVP:
                cmd = "OVP%01.0f";
-               value = (devc->OVP_enabled) ? 1 : 0;
+               value = (devc->ovp_enabled) ? 1 : 0;
                break;
        case KDXXXXP_SAVE:
                cmd = "SAV%01.0f";
@@ -249,13 +250,12 @@ SR_PRIV int korad_kdxxxxp_get_reply(struct sr_serial_dev_inst *serial,
        devc->reply[count] = 0;
 
        if (target) {
-               /* Handle the strange 'M' */
+               /* Handle the strange 'M'. */
                if (devc->reply[0] == 'M') {
-                       for (i = 1; i < count; ++i) {
+                       for (i = 1; i < count; i++)
                                devc->reply[i - 1] = devc->reply[i];
-                       }
-                       /* Get the last character */
-                       if (( i = korad_kdxxxxp_read_chars(serial, 1,
+                       /* Get the last character. */
+                       if ((i = korad_kdxxxxp_read_chars(serial, 1,
                                                &(devc->reply[count]))) < 0)
                                return i;
                }
@@ -274,11 +274,11 @@ SR_PRIV int korad_kdxxxxp_get_reply(struct sr_serial_dev_inst *serial,
                 * 00 independent 01 series 11 parallel
                 */
                devc->beep_enabled = (1 << 4);
-               devc->OCP_enabled = (status_byte & (1 << 5));
+               devc->ocp_enabled = (status_byte & (1 << 5));
                devc->output_enabled = (status_byte & (1 << 6));
                /* Velleman LABPS3005 quirk */
                if (devc->output_enabled)
-                       devc->OVP_enabled = (status_byte & (1 << 7));
+                       devc->ovp_enabled = (status_byte & (1 << 7));
                sr_dbg("Status: 0x%02x", status_byte);
                sr_spew("Status: CH1: constant %s CH2: constant %s. "
                        "Tracking would be %s. Device is "
@@ -314,7 +314,7 @@ static void next_measurement(struct dev_context *devc)
        case KDXXXXP_VOLTAGE_MAX:
                devc->target = KDXXXXP_CURRENT;
                break;
-       /* Read back what was set */
+       /* Read back what was set. */
        case KDXXXXP_BEEP:
        case KDXXXXP_OCP:
        case KDXXXXP_OVP: