コード例 #1
0
        private void Initialize(ArduinoDriverConfiguration config)
        {
            logger.Info("Instantiating ArduinoDriver: {0} - {1}...", config.ArduinoModel, config.PortName);

            this.config = config;

            switch (config.ArduinoModel)
            {
            case ArduinoModel.Micro:
            {
                engineFunc = () => new RJCPSerialPortStream {
                    PortName = config.PortName, BaudRate = DriverBaudRate
                };
                break;
            }

            default:
            {
                engineFunc = () => new DefaultSerialPort {
                    PortName = config.PortName, BaudRate = DriverBaudRate
                };
                break;
            }
            }

            if (!config.AutoBootstrap)
            {
                InitializeWithoutAutoBootstrap();
            }
            else
            {
                InitializeWithAutoBootstrap();
            }
        }
コード例 #2
0
        private Task InitializeAsync(ArduinoDriverConfiguration arduinoConfig)
        {
            logger.Info("Instantiating ArduinoDriver: {0} - {1}...", arduinoConfig.ArduinoModel, arduinoConfig.PortName);

            config     = arduinoConfig;
            serialFunc = () => new SerialPortStream()
            {
                PortName = config.PortName, BaudRate = DriverBaudRate
            };

            return(config.AutoBootstrap
                ? InitializeWithAutoBootstrapAsync()
                : InitializeWithoutAutoBootstrapAsync());
        }
コード例 #3
0
        private void Initialize(ArduinoDriverConfiguration config)
        {
            logger.Info("Instantiating ArduinoDriver: {0} - {1}...", config.ArduinoModel, config.PortName);

            this.config = config;

            engineFunc = () => new DefaultSerialPort {
                PortName = config.PortName, BaudRate = DriverBaudRate
            };

            if (!config.AutoBootstrap)
            {
                InitializeWithoutAutoBootstrap();
            }
            else
            {
                throw new NotImplementedException();
            }
        }
コード例 #4
0
        private void Initialize(ArduinoDriverConfiguration arduinoConfig)
        {
            logger.Info("Instantiating ArduinoDriver: {0} - {1}...", arduinoConfig.ArduinoModel, arduinoConfig.PortName);

            config     = arduinoConfig;
            serialFunc = () => new SerialPortStream()
            {
                PortName = config.PortName, BaudRate = DriverBaudRate
            };

            if (!config.AutoBootstrap)
            {
                InitializeWithoutAutoBootstrap();
            }
            else
            {
                InitializeWithAutoBootstrap();
            }
        }