Beispiel #1
0
        /// <summary>
        /// ConfigCom测试函数
        /// </summary>
        private void ConfigComTest()
        {
            //一次性绑定所有配置
            //cc = new ConfigCom(cbSerial, cbBaudRate, cbDataBits, cbStop, cbParity);

            //常用绑定配置
            //cc = new ConfigCom(cbSerial, cbBaudRate);

            //选择绑定配置
            cc = new ConfigCom(cbSerial);
            cc.BindBaudRateObj(cbBaudRate);
            cc.BindDataBitsObj(cbDataBits);
            cc.BindStopBitsObj(cbStop);
            cc.BindParityObj(cbParity);

            //设置默认搜索串口信息(覆盖已存在的)
            cc.SetSerialPortDefaultInfo("TI CC2540 USB CDC Serial Port");

            //添加默认搜索串口信息(追加)
            cc.AddSerialPortDefaultInfo("通用USB串口设备");
        }
Beispiel #2
0
        /// <summary>
        /// 初始化串口配置控件
        /// </summary>
        private void initSerialConfig()
        {
            //实例化串口配置
            configCom = new ConfigCom(cbSerial);
            configCom.BindBaudRateObj(cbBaudRate);
            configCom.BindDataBitsObj(cbDataBits);
            configCom.BindStopBitsObj(cbStop);
            configCom.BindParityObj(cbParity);
            configCom.BaudRate = 115200;

            //初始化串口配置
            ConfigComType defConfig = GetSerialConfig();

            configCom.BaudRate = defConfig.BaudRate;
            configCom.DataBits = defConfig.DataBits;
            configCom.StopBits = defConfig.StopBits;
            configCom.Parity   = defConfig.Parity;

            //设置串口搜索默认值
            configCom.SetSerialPortDefaultInfo("USB 串行设备"); //TI CC2540 USB CDC Serial Port
            configCom.AddSerialPortDefaultInfo("TI CC2540 USB CDC Serial Port");
        }