public RaspiAtxConnection(IController controller, IGpioConnectionDriver driver)
        {
            // set boot ok pin
            _bookOkPin = ConnectorPin.P1Pin11.Output().Revert();

            // listen to shutdown gpio
            var shutdownPin = ConnectorPin.P1Pin13
                .Input()
                .PullDown()
                .OnStatusChanged(state =>
                {
                    if (state)
                    {
                        log.Info(m => m("Shutdown triggered by RaspiAtx"));

                        controller.Shutdown();
                    }
                });

            // connect on/off button trigger pin
            _triggerOnOffButtonPin = driver.Out(ConnectorPin.P1Pin32);

            // open connection
            _gpioConnection = new GpioConnection(_bookOkPin, shutdownPin);
        }
Пример #2
0
 public void Setup()
 {
     redLed = ConnectorPin.P1Pin12.Output();
     yellowLed = ConnectorPin.P1Pin16.Output();
     greenLed = ConnectorPin.P1Pin18.Output();
     leds = new OutputPinConfiguration[] { redLed, greenLed, yellowLed };
     conn = new GpioConnection(leds);
 }
        public AmplifierConnection()
        {
            log.Debug(m => m("Init amplifier connection"));

            // connect volume via i2c
            _i2cDriver = new I2cDriver(ProcessorPin.Pin2, ProcessorPin.Pin3);
            _connection = _i2cDriver.Connect(0x4b);

            // connect shutdown via gpio
            _shutdownPin = ConnectorPin.P1Pin36.Output().Revert();
            _gpioConnection = new GpioConnection(_shutdownPin);
        }
Пример #4
0
        public clsRinger(OutputPinConfiguration RingerPower, OutputPinConfiguration RingerOscillator, float[] RingPattern = null)
        {
            if (RingPattern==null) RingPattern = ringPattern_UK;
            ringPattern = RingPattern;

            RingerPowerPin = RingerPower;
            RingerOscillatorPin = RingerOscillator;

            var GPIOconfig = new GpioConnectionSettings();
            GPIO = new GpioConnection(GPIOconfig,RingerPowerPin,RingerOscillatorPin);

            RingerThread = new Thread(Ring);
            RingerThread.IsBackground = true;
            RingerThread.Name = "Ringer Thread";
        }
Пример #5
0
        public CommandExecuter(Settings setting)
        {
            this.setting = setting;

            servo = new ProcessStartInfo("/bin/bash");
            servo.UseShellExecute = false;
            servo.CreateNoWindow = true;
            servo.RedirectStandardOutput = true;
            servo.RedirectStandardError = true;
         
#if !DEBUG
            pin1 = ConnectorPin.P1Pin38.Output();
            pin2 = ConnectorPin.P1Pin40.Output();
            connection = new GpioConnection(pin1, pin2);
#endif
        }
 /// <summary>
 /// Indicates the specified pin is disabled on connection.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <returns>The pin configuration.</returns>
 public static OutputPinConfiguration Disable(this OutputPinConfiguration configuration)
 {
     configuration.Enabled = false;
     return(configuration);
 }
 /// <summary>
 /// Indicates the specified pin is enabled on connection.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <returns>The pin configuration.</returns>
 public static OutputPinConfiguration Enable(this OutputPinConfiguration configuration)
 {
     configuration.Enabled = true;
     return(configuration);
 }
Пример #8
0
        public FridgeController(int sensorPin, OutputPinConfiguration fridgePin, float lt, float ht)
        {

            HighTemp = ht;
            LowTemp = lt;
            this._fridgePin = fridgePin;
            try
            {
                _cnFridge = new GpioConnection(fridgePin);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed To Create FridgeController");
                Console.WriteLine(ex.ToString());
            }
        }
Пример #9
0
        /// <summary>
        /// Initializes a ne
        /// </summary>
        /// <param name="pin">Pin. Pin that the temperature sensor is connected to.</param>
        public FridgeController(int sensorPin, OutputPinConfiguration fridgePin)
            : this(sensorPin, fridgePin, -1, 1)
        {

        }