X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=inline;f=hardware%2Fcem-dt-885x%2Fprotocol.h;h=49fe55d3aab3111f1dca469de749a12a39da93ec;hb=a90e480cdc808d0c91eecc6b5078e745a751882b;hp=7f296e83dc3cf4422c004ba4d24eb25d5569ca93;hpb=e37c4b3959052691a9e9d9ec4cfcdf0f8c6e36e1;p=libsigrok.git diff --git a/hardware/cem-dt-885x/protocol.h b/hardware/cem-dt-885x/protocol.h index 7f296e83..49fe55d3 100644 --- a/hardware/cem-dt-885x/protocol.h +++ b/hardware/cem-dt-885x/protocol.h @@ -35,6 +35,9 @@ #define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) #define BUF_SIZE 32 +/* When in hold mode, force the last measurement out at this interval. + * We're using 50ms, which duplicates the non-hold 20Hz update rate. */ +#define HOLD_REPEAT_INTERVAL 50 * 1000 enum { TOKEN_WEIGHT_TIME_FAST = 0x02, @@ -63,15 +66,25 @@ enum { TOKEN_MEAS_RANGE_80_130 = 0x4c, }; +enum { + CMD_TOGGLE_RECORDING = 0x55, + CMD_TOGGLE_WEIGHT_FREQ = 0x99, + CMD_TOGGLE_WEIGHT_TIME = 0x77, + CMD_TOGGLE_HOLD_MAX_MIN = 0x11, +}; + /** Private, per-device-instance driver context. */ struct dev_context { + /* Device state */ + uint64_t cur_mqflags; + int recording; + /* Acquisition settings */ uint64_t limit_samples; /* Operational state */ int state; uint64_t num_samples; - uint64_t cur_mqflags; /* Temporary state across callbacks */ void *cb_data; @@ -79,7 +92,8 @@ struct dev_context { unsigned char token; int buf_len; unsigned char buf[BUF_SIZE]; - + float last_spl; + gint64 hold_last_sent; }; /* Parser state machine. */ @@ -91,5 +105,14 @@ enum { }; SR_PRIV int cem_dt_885x_receive_data(int fd, int revents, void *cb_data); +SR_PRIV int cem_dt_885x_recording_set(const struct sr_dev_inst *sdi, gboolean start); +SR_PRIV gboolean cem_dt_885x_recording_get(const struct sr_dev_inst *sdi); +SR_PRIV int cem_dt_885x_weight_freq_get(const struct sr_dev_inst *sdi); +SR_PRIV int cem_dt_885x_weight_freq_set(const struct sr_dev_inst *sdi, int freqw); +SR_PRIV int cem_dt_885x_weight_time_get(const struct sr_dev_inst *sdi); +SR_PRIV int cem_dt_885x_weight_time_set(const struct sr_dev_inst *sdi, int timew); +SR_PRIV int cem_dt_885x_holdmode_get(const struct sr_dev_inst *sdi, + gboolean *holdmode); +SR_PRIV int cem_dt_885x_holdmode_set(const struct sr_dev_inst *sdi, int holdmode); #endif