コード例 #1
0
 /// <summary>
 /// Creates the controls module.
 /// </summary>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <returns>A <see cref="ControlsModuleFactory"/>.</returns>
 protected virtual IControlsModuleFactory CreateControlsModule(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     return(new ControlsModuleFactory(
                gpioConnectionDriverFactory,
                new AmplifierLogger(this.logger, LogEventLevel.Debug),
                this.disposableLogger));
 }
コード例 #2
0
 public TestControlsModuleFactory(
     IGpioConnectionDriverFactory gpioConnectionDriverFactory,
     IAmplifierReporter amplifierReporter,
     IDisposableReporter disposableReporter)
     : base(gpioConnectionDriverFactory, amplifierReporter, disposableReporter)
 {
 }
コード例 #3
0
        /// <summary>Initializes a new instance of the <see cref="ControlsModuleFactory"/> class.</summary>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver.</param>
        /// <param name="amplifierReporter">The amplifier reporter.</param>
        /// <param name="disposableReporter">The disposable reporter.</param>
        public ControlsModuleFactory(
            IGpioConnectionDriverFactory gpioConnectionDriverFactory,
            IAmplifierReporter amplifierReporter,
            IDisposableReporter disposableReporter)
        {
            this.gpioConnectionDriverFactory = gpioConnectionDriverFactory;
            this.amplifierReporter           = amplifierReporter;
            this.controlsModule = new AsyncLazy <IControlsModule, PrivateControlModule>(() =>
            {
                // Create Hardware
                var systemControlFactory = this.CreateSystemControlFactory();
                var inputControls        = this.CreateInputControls(this.gpioConnectionDriverFactory);
                var systemControl        = systemControlFactory.Create(this.gpioConnectionDriverFactory);

                var amplifierFactory = this.CreateAmplifierFactory();
                var amplifier        = amplifierFactory.Create(this.amplifierReporter);

                var disposer = new Disposer(
                    disposableReporter,
                    systemControlFactory,
                    amplifierFactory,
                    inputControls.RemoteControl,
                    inputControls.RfidTransceiver,
                    inputControls.RotaryEncoder,
                    inputControls.ButtonsGpioConnection);
                return(new PrivateControlModule(inputControls, systemControl, amplifier, disposer));
            });
        }
コード例 #4
0
        /// <summary>
        /// Ensures the gpio connection driver factory.
        /// </summary>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <returns>
        /// A <see cref="IGpioConnectionDriverFactory" />.
        /// </returns>
        public static IGpioConnectionDriverFactory EnsureGpioConnectionDriverFactory(
            IGpioConnectionDriverFactory gpioConnectionDriverFactory)
        {
            if (gpioConnectionDriverFactory != null)
            {
                return(new DeferredGpioConnectionDriverFactory(gpioConnectionDriverFactory));
            }

            return(new GpioConnectionDriverFactory());
        }
コード例 #5
0
 protected override InputControls CreateInputControls(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     return(new InputControls(
                New.Mock <IButtonDevice>(),
                New.Mock <IButtonDevice>(),
                New.Mock <IButtonDevice>(),
                New.Mock <IButtonDevice>(),
                New.Mock <IRfidConnection>(),
                New.Mock <ILircDevice>(),
                New.Mock <IRotaryEncoderWithButtonDevice>(),
                New.Mock <IDisposable>()));
 }
コード例 #6
0
 public TestStartupModuleFactory(
     IApplicationRendering application,
     IGpioConnectionDriverFactory gpioConnectionDriverFactory,
     string namePath         = "name.val",
     string pin26FeaturePath = "pin26-feature.val",
     string greetingsPath    = "greetings.csv",
     string lastGreetingPath = "last-greeting.val",
     ITextViewRendererReporter textViewRendererReporter = null,
     IInputManagerReporter inputManagerReporter         = null)
     : base(application, gpioConnectionDriverFactory, namePath, pin26FeaturePath, greetingsPath, lastGreetingPath, textViewRendererReporter, inputManagerReporter)
 {
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Mfrc522Connection" /> class.
 /// </summary>
 /// <param name="spiDevicePath">The spi device path.</param>
 /// <param name="resetConnectorPin">The reset connector pin.</param>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <param name="threadFactory">The thread factory.</param>
 /// <param name="rfidConnectionReporter">The rfid connection reporter.</param>
 public Mfrc522Connection(
     string spiDevicePath,
     ConnectorPin?resetConnectorPin,
     IGpioConnectionDriverFactory?gpioConnectionDriverFactory = null,
     IThreadFactory?threadFactory = null,
     IRfidConnectionReporter?rfidConnectionReporter = null)
 {
     this.spiDevicePath          = spiDevicePath;
     this.resetConnectorPin      = resetConnectorPin;
     this.rfidConnectionReporter = rfidConnectionReporter;
     this.rfidConnectionReporter?.SetSource(typeof(IRfidConnectionReporter), this);
     this.thread = ThreadFactory.EnsureThreadFactory(threadFactory).Create();
     this.gpioConnectionDriverFactory =
         GpioConnectionDriverFactory.EnsureGpioConnectionDriverFactory(gpioConnectionDriverFactory);
     this.gpioConnectionDriver = this.gpioConnectionDriverFactory.Get();
     this.mfrc522Device        = new Mfrc522Device(this.thread, this.gpioConnectionDriver);
     this.scanningJob          = new ContinuousJob(this.CheckForTags, (Exception exception, ref bool _) => this.rfidConnectionReporter?.OnException(exception));
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ky040Device" /> class.
 /// </summary>
 /// <param name="clockConnectorPin">The clock connector pin.</param>
 /// <param name="dataConnectorPin">The data connector pin.</param>
 /// <param name="buttonConnectorPin">The button connector pin.</param>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <param name="rotaryEncoderReporter">The ky040 reporter.</param>
 public Ky040Device(
     ConnectorPin clockConnectorPin,
     ConnectorPin dataConnectorPin,
     ConnectorPin buttonConnectorPin,
     IGpioConnectionDriverFactory?gpioConnectionDriverFactory = null,
     IRotaryEncoderReporter?rotaryEncoderReporter             = null)
 {
     this.gpioConnectionDriverFactory = GpioConnectionDriverFactory.EnsureGpioConnectionDriverFactory(gpioConnectionDriverFactory);
     this.gpioConnectionDriver        = this.gpioConnectionDriverFactory.Get();
     this.rotaryEncoderReporter       = rotaryEncoderReporter;
     this.rotaryEncoderReporter?.SetSource(typeof(IRotaryEncoderReporter), this);
     this.clkPinConfiguration = clockConnectorPin.Input().PullUp();
     this.clkPinConfiguration.OnStatusChanged(this.OnEncoderChanged);
     this.dtPinConfiguration = dataConnectorPin.Input().PullUp();
     this.dtPinConfiguration.OnStatusChanged(this.OnEncoderChanged);
     this.buttonPinConfiguration = buttonConnectorPin.Input().PullUp();
     this.buttonPinConfiguration.OnStatusChanged(this.OnButtonPressed);
     this.clockProcessorPin = clockConnectorPin.ToProcessor();
     this.dataProcessorPin  = dataConnectorPin.ToProcessor();
 }
コード例 #9
0
ファイル: StartupModuleFactory.cs プロジェクト: hugener/Aupli
        /// <summary>
        /// Initializes a new instance of the <see cref="SystemBoundaries.StartupModuleFactory" /> class.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <param name="namePath">The name path.</param>
        /// <param name="pin26FeaturePath">The pin26 feature path.</param>
        /// <param name="greetingsPath">The greetings path.</param>
        /// <param name="lastGreetingPath">The last greeting path.</param>
        /// <param name="textViewRendererReporter">The text view renderer reporter.</param>
        /// <param name="inputManagerReporter">The input manager reporter.</param>
        /// <param name="disposableReporter">The disposable reporter.</param>
        /// <param name="timeIntervalSynchronizerReporter">The time interval synchronizer reporter.</param>
        public StartupModuleFactory(
            IApplicationRendering application,
            IGpioConnectionDriverFactory gpioConnectionDriverFactory,
            string namePath         = "name.val",
            string pin26FeaturePath = "pin26-feature.val",
            string greetingsPath    = "greetings.csv",
            string lastGreetingPath = "last-greeting.val",
            ITextViewRendererReporter?textViewRendererReporter = null,
            IInputManagerReporter?inputManagerReporter         = null,
            IDisposableReporter?disposableReporter             = null,
            ITimeIntervalSynchronizerReporter?timeIntervalSynchronizerReporter = null)
        {
            this.application = application;
            this.gpioConnectionDriverFactory = gpioConnectionDriverFactory;
            this.namePath                         = namePath;
            this.pin26FeaturePath                 = pin26FeaturePath;
            this.greetingsPath                    = greetingsPath;
            this.lastGreetingPath                 = lastGreetingPath;
            this.textViewRendererReporter         = textViewRendererReporter;
            this.inputManagerReporter             = inputManagerReporter;
            this.timeIntervalSynchronizerReporter = timeIntervalSynchronizerReporter;
            this.startupModule                    = new AsyncLazy <IStartupModule, StartupModuleData>(
                async() =>
            {
                var lifecycleConfiguration = await this.GetLifecycleConfigurationAsync().ConfigureAwait(false);
                var greetingProvider       = this.CreateGreetingProvider();

                var displayFactory = this.CreateDisplayFactory();
                var display        = displayFactory.Create(
                    this.gpioConnectionDriverFactory,
                    lifecycleConfiguration.Pin26Feature == Pin26Feature.Backlight);

                this.application.InputManagerReporter             = this.inputManagerReporter;
                this.application.TextViewRendererReporter         = this.textViewRendererReporter;
                this.application.TimeIntervalSynchronizerReporter = this.timeIntervalSynchronizerReporter;

                var textViewNavigator = this.application.StartRendering(display, TimeSpan.FromMilliseconds(200));
                var disposer          = new Disposer(disposableReporter, displayFactory);
                return(new StartupModuleData(display, textViewNavigator, lifecycleConfiguration, greetingProvider, disposer));
            });
        }
コード例 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Max9744Device" /> class.
        /// </summary>
        /// <param name="i2cAddress">The i2c address.</param>
        /// <param name="mutePin">The mute pin.</param>
        /// <param name="shutdownPin">The shutdown pin.</param>
        /// <param name="sdaPin">The sda pin.</param>
        /// <param name="sclPin">The SCL pin.</param>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <param name="i2CDeviceConnectionReporter">The i2 c device connection reporter.</param>
        public Max9744Device(
            byte i2cAddress,
            ConnectorPin mutePin,
            ConnectorPin shutdownPin,
            ProcessorPin sdaPin,
            ProcessorPin sclPin,
            IGpioConnectionDriverFactory? gpioConnectionDriverFactory,
            II2cDeviceConnectionReporter? i2CDeviceConnectionReporter = null)
        {
            this.gpioConnectionDriverFactory = GpioConnectionDriverFactory.EnsureGpioConnectionDriverFactory(gpioConnectionDriverFactory);
            this.gpioConnectionDriver = this.gpioConnectionDriverFactory.Get();

            // connect volume via i2c
            this.i2CDriver = new I2cDriver(sdaPin, sclPin);
            this.connection = this.i2CDriver.Connect(i2cAddress, i2CDeviceConnectionReporter);

            // connect shutdown via gpio
            this.mutePin = mutePin.Output().Revert();
            this.shutdownPin = shutdownPin.Output().Revert();
            this.gpioConnection = new GpioConnection(this.gpioConnectionDriverFactory, this.shutdownPin, this.mutePin);
        }
コード例 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemotePiDevice" /> class.
        /// </summary>
        /// <param name="shutdownInConnectorPin">The shutdown in connector pin.</param>
        /// <param name="shutdownOutConnectorPin">The shutdown out connector pin.</param>
        /// <param name="operatingSystemShutdown">The operation system shutdown.</param>
        /// <param name="shutdownTimeSpan">The shutdown time span.</param>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <param name="dateTime">The date time.</param>
        /// <param name="threadFactory">The thread factory.</param>
        public RemotePiDevice(
            ConnectorPin shutdownInConnectorPin,
            ConnectorPin shutdownOutConnectorPin,
            IOperatingSystemShutdown operatingSystemShutdown,
            TimeSpan shutdownTimeSpan,
            IGpioConnectionDriverFactory?gpioConnectionDriverFactory = null,
            IDateTime?dateTime           = null,
            IThreadFactory?threadFactory = null)
        {
            this.gpioConnectionDriverFactory = GpioConnectionDriverFactory.EnsureGpioConnectionDriverFactory(gpioConnectionDriverFactory);
            this.gpioConnectionDriver        = this.gpioConnectionDriverFactory.Get();
            this.shutdownInConnectorPin      = shutdownInConnectorPin;
            this.shutdownOutConnectorPin     = shutdownOutConnectorPin;
            this.operatingSystemShutdown     = operatingSystemShutdown;
            this.shutdownTimeSpan            = shutdownTimeSpan < TimeSpan.FromSeconds(4) ? TimeSpan.FromSeconds(4) : shutdownTimeSpan;
            this.dateTime = dateTime ?? new DateTimeProvider();
            this.thread   = ThreadFactory.EnsureThreadFactory(threadFactory).Create();
            var pinConfiguration = shutdownInConnectorPin.Input().PullDown();

            pinConfiguration.OnStatusChanged(this.OnShutdown);
            this.gpioConnection = new GpioConnection(new GpioConnectionDriverFactory(this.gpioConnectionDriver), pinConfiguration);
        }
コード例 #12
0
        /// <summary>
        /// Creates the specified gpio connection driver.
        /// </summary>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <returns>
        /// The input controls.
        /// </returns>
        public static InputControls Create(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
        {
            var lircConnection  = new LircDevice();
            var playPauseButton = new PullDownButtonDevice(ConnectorPin.P1Pin15);
            var nextButton      = new PullDownButtonDevice(ConnectorPin.P1Pin18);
            var previousButton  = new PullDownButtonDevice(ConnectorPin.P1Pin16);
            var menuButton      = new PullDownButtonDevice(ConnectorPin.P1Pin13);
            var rfidTransceiver = new Mfrc522Connection("/dev/spidev0.0", ConnectorPin.P1Pin22, gpioConnectionDriverFactory);
            var ky040Connection = new Ky040Device(
                ConnectorPin.P1Pin36,
                ConnectorPin.P1Pin38,
                ConnectorPin.P1Pin40,
                gpioConnectionDriverFactory,
                null);
            var buttonsGpioConnection = new GpioConnection(
                gpioConnectionDriverFactory,
                new[]
            {
                playPauseButton.PinConfiguration,
                nextButton.PinConfiguration,
                previousButton.PinConfiguration,
                menuButton.PinConfiguration,
            }.Where(x => x != null));

            return(new InputControls(
                       playPauseButton,
                       nextButton,
                       previousButton,
                       menuButton,
                       rfidTransceiver,
                       lircConnection,
                       ky040Connection,
                       buttonsGpioConnection));

            /* new Rfid(),
             * new Lirc(),
             * new Rotary(),
             * new Dispo());*/
        }
コード例 #13
0
        private static (ITextDisplayDevice, IDisposable) Create(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
        {
            var hd44780LcdDeviceSettings = new Hd44780LcdDeviceSettings
            {
                ScreenHeight = 2,
                ScreenWidth  = 16,
                Encoding     = new Hd44780A00Encoding(),
                SyncDelay    = TimeSpan.FromMilliseconds(10),
            };
            var hd44780LcdDevice = new Hd44780LcdDevice(
                hd44780LcdDeviceSettings,
                gpioConnectionDriverFactory,
                ConnectorPin.P1Pin29,
                ConnectorPin.P1Pin32,
                new Hd44780DataPins(
                    ConnectorPin.P1Pin31,
                    ConnectorPin.P1Pin33,
                    ConnectorPin.P1Pin35,
                    ConnectorPin.P1Pin37));

            return(new Hd44780TextDisplayDevice(hd44780LcdDevice, hd44780LcdDeviceSettings), hd44780LcdDevice);
        }
コード例 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GpioConnection" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="pins">The pins.</param>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <param name="threadFactory">The thread factory.</param>
        public GpioConnection(GpioConnectionSettings settings, IEnumerable <PinConfiguration> pins, IGpioConnectionDriverFactory gpioConnectionDriverFactory = null, IThreadFactory threadFactory = null)
        {
            this.settings = settings ?? new GpioConnectionSettings();
            this.gpioConnectionDriverFactory = GpioConnectionDriverFactory.EnsureGpioConnectionDriverFactory(gpioConnectionDriverFactory);
            this.gpioConnectionDriver        = this.gpioConnectionDriverFactory.Get();
            this.thread = ThreadFactory.EnsureThreadFactory(threadFactory).Create();
            this.Pins   = new ConnectedPins(this);

            var pinList = pins.ToList();

            this.pinConfigurations = pinList.ToDictionary(p => p.Pin);

            this.namedPins = pinList.Where(p => !string.IsNullOrEmpty(p.Name)).ToDictionary(p => p.Name);

            this.timer = Core.Timers.Timer.Create();

            this.timer.Tick += this.CheckInputPins;

            if (this.settings.Opened)
            {
                this.Open();
            }
        }
コード例 #15
0
ファイル: DisplayFactory.cs プロジェクト: hugener/Aupli
        /// <summary>
        /// Creates the specified gpio connection driver.
        /// </summary>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <param name="hasBacklight">if set to <c>true</c> [has backlight].</param>
        /// <returns>
        /// A <see cref="Hd44780Display" />.
        /// </returns>
        public IDisplay Create(IGpioConnectionDriverFactory gpioConnectionDriverFactory, bool hasBacklight)
        {
            var hd44780LcdDeviceSettings = new Hd44780LcdDeviceSettings
            {
                ScreenHeight = 2,
                ScreenWidth  = 16,
                Encoding     = new Hd44780A00Encoding(),
            };
            var backlight        = hasBacklight ? new ConnectorPin?(ConnectorPin.P1Pin26) : null;
            var hd44780LcdDevice = new Hd44780LcdDevice(
                hd44780LcdDeviceSettings,
                gpioConnectionDriverFactory,
                ConnectorPin.P1Pin29,
                ConnectorPin.P1Pin32,
                new Hd44780DataPins(
                    ConnectorPin.P1Pin31,
                    ConnectorPin.P1Pin33,
                    ConnectorPin.P1Pin35,
                    ConnectorPin.P1Pin37),
                backlight);

            return(this.textDisplayDevices.Add(new Hd44780Display(hd44780LcdDevice, hd44780LcdDeviceSettings), hd44780LcdDevice));
        }
コード例 #16
0
ファイル: Hd44780LcdDevice.cs プロジェクト: hugener/Pi
        /// <summary>
        /// Initializes a new instance of the <see cref="Hd44780LcdDevice"/> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <param name="registerSelectPin">The register select pin.</param>
        /// <param name="clockPin">The clock pin.</param>
        /// <param name="hd44780DataPins">The HD44780 data pins.</param>
        /// <param name="backlight">The backlight.</param>
        /// <param name="readWrite">The read write.</param>
        /// <param name="threadFactory">The thread factory.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// pins - There must be either 4 or 8 data pins
        /// or
        /// settings - ScreenHeight must be between 1 and 4 rows
        /// or
        /// settings - PatternWidth must be 5 pixels
        /// or
        /// settings - PatternWidth must be either 7 or 10 pixels height.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// At most 80 characters are allowed
        /// or
        /// 10 pixels height pattern cannot be used with an even number of rows.
        /// </exception>
        public Hd44780LcdDevice(
            Hd44780LcdDeviceSettings settings,
            IGpioConnectionDriverFactory gpioConnectionDriverFactory,
            ConnectorPin registerSelectPin,
            ConnectorPin clockPin,
            Hd44780DataPins hd44780DataPins,
            ConnectorPin?backlight       = null,
            ConnectorPin?readWrite       = null,
            IThreadFactory threadFactory = null)
        {
            this.gpioConnectionDriverFactory = GpioConnectionDriverFactory.EnsureGpioConnectionDriverFactory(gpioConnectionDriverFactory);
            this.gpioConnectionDriver        = gpioConnectionDriverFactory.Get();
            this.pins      = new Hd44780Pins(this.gpioConnectionDriver, registerSelectPin, clockPin, backlight, readWrite, hd44780DataPins.ConnectorPins);
            this.thread    = ThreadFactory.EnsureThreadFactory(threadFactory).Create();
            this.syncDelay = settings.SyncDelay;

            if (this.pins.Data.Length != 4 && this.pins.Data.Length != 8)
            {
                throw new ArgumentOutOfRangeException(nameof(hd44780DataPins), this.pins.Data.Length, "There must be either 4 or 8 data pins");
            }

            this.width  = settings.ScreenWidth;
            this.height = settings.ScreenHeight;
            if (this.height < 1 || this.height > MaxHeight)
            {
                throw new ArgumentOutOfRangeException(nameof(settings.ScreenHeight), this.height, "ScreenHeight must be between 1 and 4 rows");
            }

            if (this.width * this.height > MaxChar)
            {
                throw new ArgumentException("At most 80 characters are allowed");
            }

            if (settings.PatternWidth != 5)
            {
                throw new ArgumentOutOfRangeException(nameof(settings.PatternWidth), settings.PatternWidth, "PatternWidth must be 5 pixels");
            }

            if (settings.PatternHeight != 8 && settings.PatternHeight != 10)
            {
                throw new ArgumentOutOfRangeException(nameof(settings.PatternHeight), settings.PatternHeight, "PatternHeight must be either 7 or 10 pixels height");
            }

            if (settings.PatternHeight == 10 && this.height % 2 == 0)
            {
                throw new ArgumentException("10 pixels height pattern cannot be used with an even number of rows");
            }

            this.functions = (settings.PatternHeight == 8 ? Functions.Matrix5X8 : Functions.Matrix5X10)
                             | (this.height == 1 ? Functions.OneLine : Functions.TwoLines)
                             | (this.pins.Data.Length == 4 ? Functions.Data4Bits : Functions.Data8Bits);

            this.entryModeFlags = /*settings.RightToLeft
                                   * ? EntryModeFlags.EntryRight | EntryModeFlags.EntryShiftDecrement
                                   * :*/EntryModeFlags.EntryLeft | EntryModeFlags.EntryShiftDecrement;

            this.encoding = settings.Encoding;

            this.BacklightEnabled = false;

            this.pins.ReadWrite?.Write(false);

            this.pins.RegisterSelect.Write(false);
            this.pins.Clock.Write(false);
            foreach (var dataPin in this.pins.Data)
            {
                dataPin.Write(false);
            }

            this.WriteByte(0x33, false); // Initialize
            this.WriteByte(0x32, false);

            this.thread.Sleep(TimeSpanUtility.FromMicroseconds(50));

            this.WriteCommand(Command.SetFunctions, (int)this.functions);
            this.WriteCommand(Command.SetDisplayFlags, (int)this.displayFlags);
            this.WriteCommand(Command.SetEntryModeFlags, (int)this.entryModeFlags);

            this.Clear();
            this.BacklightEnabled = true;
        }
コード例 #17
0
ファイル: SystemControlFactory.cs プロジェクト: hugener/Aupli
 /// <summary>
 /// Creates the specified gpio connection driver.
 /// </summary>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <returns>
 /// A <see cref="RemotePiDevice" />.
 /// </returns>
 public ISystemControl Create(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     var remotePiDevice = new RemotePiDevice(ConnectorPin.P1Pin08, ConnectorPin.P1Pin10, new OperatingSystemControl(), default, gpioConnectionDriverFactory);
コード例 #18
0
ファイル: TestBootstrapper.cs プロジェクト: hugener/Aupli
 protected override IControlsModuleFactory CreateControlsModule(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     this.ControlsModuleFactory = new TestControlsModuleFactory(gpioConnectionDriverFactory, null, null);
     return(this.ControlsModuleFactory);
 }
コード例 #19
0
 /// <summary>
 /// Creates the startup module.
 /// </summary>
 /// <param name="application">The application.</param>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <returns>
 /// The startup module.
 /// </returns>
 protected virtual IStartupModuleFactory CreateStartupModule(IApplication application, IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     return(new StartupModuleFactory(
                application,
                gpioConnectionDriverFactory,
                "name.val",
                "pin26-feature.val",
                "greetings.csv",
                "last-greeting.val",
                new TextViewRendererLogger(this.logger),
                new InputManagerLogger(this.logger),
                this.disposableLogger,
                new TimeIntervalSynchronizerLogger(this.logger)));
 }
コード例 #20
0
 public DeferredGpioConnectionDriverFactory(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     this.gpioConnectionDriverFactory = gpioConnectionDriverFactory;
 }
コード例 #21
0
 /// <summary>
 /// Creates the input controls.
 /// </summary>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <returns>
 /// A input controls.
 /// </returns>
 protected virtual InputControls CreateInputControls(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     return(InputControlsFactory.Create(gpioConnectionDriverFactory));
 }
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GpioConnection" /> class.
 /// </summary>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <param name="pins">The pins.</param>
 public GpioConnection(IGpioConnectionDriverFactory gpioConnectionDriverFactory, params PinConfiguration[] pins)
     : this(null, pins, gpioConnectionDriverFactory)
 {
 }
コード例 #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GpioConnection" /> class.
 /// </summary>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <param name="pins">The pins.</param>
 public GpioConnection(IGpioConnectionDriverFactory gpioConnectionDriverFactory, IEnumerable <PinConfiguration> pins)
     : this(null, pins, gpioConnectionDriverFactory)
 {
 }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GpioConnection" /> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
 /// <param name="pins">The pins.</param>
 public GpioConnection(GpioConnectionSettings settings, IGpioConnectionDriverFactory gpioConnectionDriverFactory, params PinConfiguration[] pins)
     : this(settings, pins, gpioConnectionDriverFactory)
 {
 }
コード例 #25
0
ファイル: TestBootstrapper.cs プロジェクト: hugener/Aupli
 protected override IStartupModuleFactory CreateStartupModule(IApplication application, IGpioConnectionDriverFactory gpioConnectionDriverFactory)
 {
     this.StartupModuleFactory = new TestStartupModuleFactory(application, gpioConnectionDriverFactory);
     return(this.StartupModuleFactory);
 }