X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fhardware%2Fmotech-lps-30x%2Fprotocol.h;h=53aa0325b2dfd9e04e6ae335032f2fad9364937e;hb=86f76e6cae622673b65823fa6bfc31365fd9487b;hp=94eeb67e0fe37bf6c81de08fb34dd8d9c21e9cb4;hpb=f3f19d1131025b68d29a11273b627c83d748e7ea;p=libsigrok.git
diff --git a/src/hardware/motech-lps-30x/protocol.h b/src/hardware/motech-lps-30x/protocol.h
index 94eeb67e..53aa0325 100644
--- a/src/hardware/motech-lps-30x/protocol.h
+++ b/src/hardware/motech-lps-30x/protocol.h
@@ -18,26 +18,19 @@
* along with this program. If not, see .
*/
-/** @file
- * Motech LPS-30x series power supply driver
- * @internal
- */
-
-
#ifndef LIBSIGROK_HARDWARE_MOTECH_LPS_30X_PROTOCOL_H
#define LIBSIGROK_HARDWARE_MOTECH_LPS_30X_PROTOCOL_H
#include
#include
-#include "libsigrok.h"
+#include
#include "libsigrok-internal.h"
-
-SR_PRIV int lps_process_status(struct sr_dev_inst* sdi, int stat);
-SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char* fmt, ...);
-
#define LOG_PREFIX "motech-lps-30x"
+SR_PRIV int lps_process_status(struct sr_dev_inst *sdi, int stat);
+SR_PRIV int lps_send_req(struct sr_serial_dev_inst *serial, const char *fmt, ...);
+
#define LINELEN_MAX 50 /**< Max. line length for requests */
#define REQ_TIMEOUT_MS 250 /**< Timeout [ms] for single request. */
@@ -63,7 +56,7 @@ struct channel_spec {
/** Model properties specification */
struct lps_modelspec {
lps_modelid modelid;
- const char* modelstr;
+ const char *modelstr;
uint8_t num_channels;
struct channel_spec channels[3];
};
@@ -81,7 +74,7 @@ typedef enum {
/** Status of a single channel. */
struct channel_status {
/* Channel information (struct channel_info*). data (struct) owned by sdi, just a reference to address a single channel. */
- GSList* info;
+ GSList *info;
/* Received from device. */
gdouble output_voltage_last;
gdouble output_current_last;
@@ -92,26 +85,18 @@ struct channel_status {
gdouble output_current_max;
};
-/** Private, per-device-instance driver context. */
struct dev_context {
- /* Model-specific information */
- const struct lps_modelspec* model;
+ const struct lps_modelspec *model;
- /* Acquisition status */
gboolean acq_running; /**< Acquisition is running. */
- uint64_t limit_samples; /**< Target number of samples */
- uint64_t limit_msec; /**< Target sampling time */
+ struct sr_sw_limits limits;
acquisition_req acq_req; /**< Current request. */
uint8_t acq_req_pending; /**< Request pending. 0=none, 1=reply, 2=OK */
- /* Operational state */
struct channel_status channel_status[MAX_CHANNELS];
guint8 tracking_mode; /**< 0=off, 1=Tracking from CH1, 2=Tracking from CH2. */
- /* Temporary state across callbacks */
int64_t req_sent_at; /**< Request sent. */
- uint64_t num_samples; /**< Current #samples for limit_samples */
- GTimer *elapsed_msec; /**< Used for sampling with limit_msec */
gchar buf[LINELEN_MAX]; /**< Buffer for read callback */
int buflen; /**< Data len in buf */
};