Beispiel #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();
            }
        }
        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());
        }
        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();
            }
        }
Beispiel #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();
            }
        }