X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fdevantech-eth008%2Fprotocol.h;h=7a687c7149076d03d46a4a0c3f9f7d79183f4a7a;hb=HEAD;hp=5834a4c9492ae95d4049d6b89505a55c01715ab9;hpb=8712c7833fdc1e33363807b094ad998df1b97463;p=libsigrok.git diff --git a/src/hardware/devantech-eth008/protocol.h b/src/hardware/devantech-eth008/protocol.h index 5834a4c9..7a687c71 100644 --- a/src/hardware/devantech-eth008/protocol.h +++ b/src/hardware/devantech-eth008/protocol.h @@ -29,34 +29,31 @@ #define LOG_PREFIX "devantech-eth008" /* - * Models have differing capabilities, and slightly different protocol - * variants. Setting the output state of individual relays usually takes - * one byte which carries the channel number. Requests are of identical - * length. Getting relay state takes a variable number of bytes to carry - * the bit fields. Response length depends on the model's relay count. - * As does request length for setting the state of several relays at the - * same time. - * - * Some models have digital inputs and analog inputs. These features - * currently are not supported in this implementation. + * See developer notes in the protocol.c source file for details on the + * feature set and communication protocol variants across the series. + * This 'model' description tells their discriminating properties apart. */ struct devantech_eth008_model { - uint8_t code; - const char *name; - size_t ch_count_do; - uint8_t min_serno_fw; - size_t width_do; -}; - -enum devantech_eth008_channel_type { - DV_CH_DIGITAL_OUTPUT, - DV_CH_SUPPLY_VOLTAGE, + uint8_t code; /**!< model ID */ + const char *name; /**!< model name */ + size_t ch_count_do; /**!< digital output channel count */ + size_t ch_count_di; /**!< digital input channel count */ + size_t ch_count_ai; /**!< analog input channel count */ + uint8_t min_serno_fw; /**!< min FW version to get serial nr */ + size_t width_do; /**!< digital output image width */ + size_t width_di; /**!< digital input image width */ + uint32_t mask_do_missing; /**!< missing digital output channels */ }; struct channel_group_context { size_t index; size_t number; - enum devantech_eth008_channel_type ch_type; + enum devantech_eth008_channel_type { + DV_CH_DIGITAL_OUTPUT, + DV_CH_DIGITAL_INPUT, + DV_CH_ANALOG_INPUT, + DV_CH_SUPPLY_VOLTAGE, + } ch_type; }; struct dev_context { @@ -64,6 +61,7 @@ struct dev_context { const struct devantech_eth008_model *model; uint32_t mask_do; uint32_t curr_do; + uint32_t curr_di; }; SR_PRIV int devantech_eth008_get_model(struct sr_serial_dev_inst *serial, @@ -75,6 +73,10 @@ SR_PRIV int devantech_eth008_query_do(const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, gboolean *on); SR_PRIV int devantech_eth008_setup_do(const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, gboolean on); +SR_PRIV int devantech_eth008_query_di(const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg, gboolean *on); +SR_PRIV int devantech_eth008_query_ai(const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg, uint16_t *adc_value); SR_PRIV int devantech_eth008_query_supply(const struct sr_dev_inst *sdi, const struct sr_channel_group *cg, uint16_t *millivolts);