X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fconrad-digi-35-cpu%2Fapi.c;h=01adcef8ab2fec517fb322b0024d5ce5dd991122;hb=d292f767bd031979edbcbf54b7daa39b0aad7812;hp=5aac3cff943d9a0caef5fd786e39eaa745541ba8;hpb=c6a2843a58a398d0095291c2a1f397b419d164f4;p=libsigrok.git diff --git a/hardware/conrad-digi-35-cpu/api.c b/hardware/conrad-digi-35-cpu/api.c index 5aac3cff..01adcef8 100644 --- a/hardware/conrad-digi-35-cpu/api.c +++ b/hardware/conrad-digi-35-cpu/api.c @@ -24,6 +24,8 @@ #include "protocol.h" +#define SERIALCOMM "9600/8n1" + static const int32_t hwopts[] = { SR_CONF_CONN, SR_CONF_SERIALCOMM, @@ -33,14 +35,10 @@ static const int32_t hwcaps[] = { SR_CONF_POWER_SUPPLY, SR_CONF_OUTPUT_VOLTAGE, SR_CONF_OUTPUT_CURRENT, - /* There is no SR_CONF_OUTPUT_ENABLED; cannot know or set status remotely. */ + /* There's no SR_CONF_OUTPUT_ENABLED; can't know/set status remotely. */ SR_CONF_OVER_CURRENT_PROTECTION, }; - -#define SERIALCOMM "9600/8n1" - - SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info; static struct sr_dev_driver *di = &conrad_digi_35_cpu_driver_info; @@ -54,7 +52,7 @@ static GSList *scan(GSList *options) struct sr_dev_inst *sdi; struct drv_context *drvc; struct sr_config *src; - struct sr_probe *probe; + struct sr_channel *ch; struct sr_serial_dev_inst *serial; GSList *l, *devices; const char *conn, *serialcomm; @@ -80,9 +78,11 @@ static GSList *scan(GSList *options) if (!serialcomm) serialcomm = SERIALCOMM; - /* We cannot scan for this device because it is write-only. + /* + * We cannot scan for this device because it is write-only. * So just check that the port parameters are valid and assume that - * the device is there. */ + * the device is there. + */ if (!(serial = sr_serial_dev_inst_new(conn, serialcomm))) return NULL; @@ -93,17 +93,17 @@ static GSList *scan(GSList *options) serial_flush(serial); serial_close(serial); - sr_spew("Conrad DIGI 35 CPU assumed at %s", conn); + sr_spew("Conrad DIGI 35 CPU assumed at %s.", conn); - if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", ""))) + if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", NULL))) return NULL; sdi->conn = serial; sdi->priv = NULL; sdi->driver = di; - if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, "CH1"))) + if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "CH1"))) return NULL; - sdi->probes = g_slist_append(sdi->probes, probe); + sdi->channels = g_slist_append(sdi->channels, ch); drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); @@ -116,25 +116,18 @@ static GSList *dev_list(void) return ((struct drv_context *)(di->priv))->instances; } -static int dev_clear(void) -{ - return std_dev_clear(di, NULL); -} - static int cleanup(void) { - dev_clear(); - - return SR_OK; + return std_dev_clear(di, NULL); } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_probe_group *probe_group) + const struct sr_channel_group *cg) { int ret; double dblval; - (void)probe_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -172,12 +165,12 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_probe_group *probe_group) + const struct sr_channel_group *cg) { int ret; (void)sdi; - (void)probe_group; + (void)cg; ret = SR_OK; switch (key) { @@ -196,8 +189,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, return ret; } -static int dev_acquisition_start_dummy(const struct sr_dev_inst *sdi, - void *cb_data) +static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) { (void)cb_data; @@ -207,7 +199,7 @@ static int dev_acquisition_start_dummy(const struct sr_dev_inst *sdi, return SR_OK; } -static int dev_acquisition_stop_dummy(struct sr_dev_inst *sdi, void *cb_data) +static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) { (void)cb_data; @@ -225,13 +217,13 @@ SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info = { .cleanup = cleanup, .scan = scan, .dev_list = dev_list, - .dev_clear = dev_clear, + .dev_clear = NULL, .config_get = NULL, .config_set = config_set, .config_list = config_list, .dev_open = std_serial_dev_open, .dev_close = std_serial_dev_close, - .dev_acquisition_start = dev_acquisition_start_dummy, - .dev_acquisition_stop = dev_acquisition_stop_dummy, + .dev_acquisition_start = dev_acquisition_start, + .dev_acquisition_stop = dev_acquisition_stop, .priv = NULL, };