};
static const struct devantech_eth008_model models[] = {
- { 19, "ETH008", 8, 0, 1, },
+ { 18, "ETH002", 2, 0, 1, 0, },
+ { 19, "ETH008", 8, 0, 1, 0, },
+ { 20, "ETH484", 16, 0, 2, 0x00f0, },
+ { 21, "ETH8020", 20, 0, 3, 0, },
};
static const struct devantech_eth008_model *find_model(uint8_t code)
ch_idx = 0;
devc->mask_do = (1UL << devc->model->ch_count_do) - 1;
+ devc->mask_do &= ~model->mask_do_missing;
for (do_idx = 0; do_idx < devc->model->ch_count_do; do_idx++) {
nr = do_idx + 1;
+ if (model->mask_do_missing & (1UL << do_idx))
+ continue;
snprintf(cg_name, sizeof(cg_name), "DO%zu", nr);
cgc = g_malloc0(sizeof(*cgc));
cg = sr_channel_group_new(sdi, cg_name, cgc);
struct dev_context *devc;
size_t rx_size;
uint8_t req[1], *wrptr;
- uint8_t rsp[1];
+ uint8_t rsp[3];
const uint8_t *rdptr;
uint32_t have;
int ret;
case 1:
have = read_u8_inc(&rdptr);
break;
+ case 2:
+ have = read_u16le_inc(&rdptr);
+ break;
+ case 3:
+ have = read_u24le_inc(&rdptr);
+ break;
default:
return SR_ERR_NA;
}
struct channel_group_context *cgc;
size_t number;
uint32_t reg;
- uint8_t req[3], *wrptr, cmd;
+ uint8_t req[4], *wrptr, cmd;
uint8_t rsp[1], v8;
const uint8_t *rdptr;
int ret;
case 1:
write_u8_inc(&wrptr, reg & 0xff);
break;
+ case 2:
+ write_u16le_inc(&wrptr, reg & 0xffff);
+ break;
+ case 3:
+ write_u24le_inc(&wrptr, reg & 0xffffff);
+ break;
default:
return SR_ERR_NA;
}
* 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.
+ * same time. Some models have gaps in their relay channel numbers
+ * (ETH484 misses R5..R8).
*
* Some models have digital inputs and analog inputs. These features
* currently are not supported in this implementation.
size_t ch_count_do;
uint8_t min_serno_fw;
size_t width_do;
+ uint32_t mask_do_missing;
};
enum devantech_eth008_channel_type {