]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/serial-dmm/api.c
Change type of SR_CONF keys to uint32_t.
[libsigrok.git] / src / hardware / serial-dmm / api.c
index b96c7a0da982c18431a2b02697843bbf71f77e38..d92b6fc137c72434bbf959fea6e1709185fe9f75 100644 (file)
 #include "libsigrok-internal.h"
 #include "protocol.h"
 
-static const int32_t hwopts[] = {
+static const uint32_t hwopts[] = {
        SR_CONF_CONN,
        SR_CONF_SERIALCOMM,
 };
 
-static const int32_t hwcaps[] = {
+static const uint32_t hwcaps[] = {
        SR_CONF_MULTIMETER,
        SR_CONF_LIMIT_SAMPLES,
        SR_CONF_LIMIT_MSEC,
@@ -74,6 +74,7 @@ SR_PRIV struct sr_dev_driver uni_t_ut61e_ser_driver_info;
 SR_PRIV struct sr_dev_driver iso_tech_idm103n_driver_info;
 SR_PRIV struct sr_dev_driver tenma_72_7745_ser_driver_info;
 SR_PRIV struct sr_dev_driver tenma_72_7750_ser_driver_info;
+SR_PRIV struct sr_dev_driver brymen_bm25x_ser_driver_info;
 
 SR_PRIV struct dmm_info dmms[] = {
        {
@@ -318,6 +319,13 @@ SR_PRIV struct dmm_info dmms[] = {
                NULL,
                &tenma_72_7750_ser_driver_info, receive_data_TENMA_72_7750_SER,
        },
+       {
+               "Brymen", "BM25x (BC20X cable)", "9600/8n1/rts=1/dtr=1",
+               9600, BRYMEN_BM25X_PACKET_SIZE, 0, 0, NULL,
+               sr_brymen_bm25x_packet_valid, sr_brymen_bm25x_parse,
+               NULL,
+               &brymen_bm25x_ser_driver_info, receive_data_BRYMEN_BM25X_SER,
+       },
 };
 
 static int dev_clear(int dmm)
@@ -327,8 +335,6 @@ static int dev_clear(int dmm)
 
 static int init(struct sr_context *sr_ctx, int dmm)
 {
-       sr_dbg("Selected '%s' subdriver.", dmms[dmm].di->name);
-
        return std_init(sr_ctx, dmms[dmm].di, LOG_PREFIX);
 }
 
@@ -459,7 +465,7 @@ static int cleanup(int dmm)
        return dev_clear(dmm);
 }
 
-static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
+static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
@@ -474,7 +480,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
                return SR_ERR_BUG;
        }
 
-       switch (id) {
+       switch (key) {
        case SR_CONF_LIMIT_SAMPLES:
                devc->limit_samples = g_variant_get_uint64(data);
                sr_dbg("Setting sample limit to %" PRIu64 ".",
@@ -492,7 +498,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
+static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
        (void)sdi;
@@ -500,12 +506,12 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
 
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                               hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t));
+               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                               hwopts, ARRAY_SIZE(hwopts), sizeof(uint32_t));
                break;
        case SR_CONF_DEVICE_OPTIONS:
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                               hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
+               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                               hwcaps, ARRAY_SIZE(hwcaps), sizeof(uint32_t));
                break;
        default:
                return SR_ERR_NA;
@@ -630,3 +636,4 @@ DRV(uni_t_ut61e_ser, UNI_T_UT61E_SER, "uni-t-ut61e-ser", "UNI-T UT61E (UT-D02 ca
 DRV(iso_tech_idm103n, ISO_TECH_IDM103N, "iso-tech-idm103n", "ISO-TECH IDM103N")
 DRV(tenma_72_7745_ser, TENMA_72_7745_SER, "tenma-72-7745-ser", "Tenma 72-7745 (UT-D02 cable)")
 DRV(tenma_72_7750_ser, TENMA_72_7750_SER, "tenma-72-7750-ser", "Tenma 72-7750 (UT-D02 cable)")
+DRV(brymen_bm25x_ser, BRYMEN_BM25X_SER, "brymen-bm25x-ser", "Brymen BM25x (BC20X cable)")