Пример #1
0
 public StatusLamp(IStatusLampSettingRepository statusLampSettingRepository, IGpioControllerFacade gpioControllerFacade)
 {
     _name = "StatusLamp";
     _statusLampSettingRepository = statusLampSettingRepository;
     _redLight   = new Light(gpioPin: 19, gpioControllerFacade: gpioControllerFacade);
     _greenLight = new Light(gpioPin: 13, gpioControllerFacade: gpioControllerFacade);
 }
Пример #2
0
        public GpioPin(IGpioControllerFacade controller, int pinNumber, PinMode pinMode)
        {
            _controller = controller;
            _pinNumber  = pinNumber;

            controller.OpenPin(_pinNumber, pinMode);
            if (pinMode == PinMode.Input)
            {
                _controller.RegisterCallbackForPinValueChangedEvent(pinNumber, PinEventTypes.Falling, ValueChangedHandler);
                _controller.RegisterCallbackForPinValueChangedEvent(pinNumber, PinEventTypes.Rising, ValueChangedHandler);
            }
        }
Пример #3
0
        public StepperDriveControl(DrivePins drivePins, IGpioControllerFacade gpioControllerFacade)
        {
            _enablePin = new GpioPin(gpioControllerFacade, drivePins.EnablePin, PinMode.Output);
            _enablePin.Write(ENA_RELEASED);

            _directionPin = new GpioPin(gpioControllerFacade, drivePins.DirectionPin, PinMode.Output);
            _directionPin.Write(BACKWARD);

            _stepPin = new GpioPin(gpioControllerFacade, drivePins.StepPin, PinMode.Output);
            _stepPin.Write(PinValue.Low);

            _referenceSwitchPin = new GpioPin(gpioControllerFacade, drivePins.ReferenceSwitchPin, PinMode.Input);
        }
Пример #4
0
        public SpiritDispenserControl(ISpiritDispenserSettingRepository dispenserSettingRepository, IEmergencyStop emergencyStop, IGpioControllerFacade gpioControllerFacade)
        {
            _name = "SpiritDispenser";
            (_spiritDispenserSettingRepository, _emergencyStop) = (dispenserSettingRepository, emergencyStop);

            _spiritSpenderMotor = new LinearMotor(forwardGpioPin: 18, backwardGpioPin: 23, gpioControllerFacade: gpioControllerFacade);

            _currentStatus             = new BehaviorSubject <Status>(emergencyStop.EmergencyStopPressed ? Status.Error : Status.NotReady);
            CurrentPosition            = SpiritDispenserPosition.Undefined;
            _cancelMovementTokensource = new CancellationTokenSource();
            emergencyStop.EmergencyStopPressedChanged += EmergencyStopPressedChanged;
        }
Пример #5
0
 private void InitGpio(int forwardGpioPin, int backwardGpioPin, IGpioControllerFacade gpioControllerFacade)
 {
     _forwardPin  = new GpioPin(gpioControllerFacade, forwardGpioPin, PinMode.Output);
     _backwardPin = new GpioPin(gpioControllerFacade, backwardGpioPin, PinMode.Output);
     StopMotor();
 }
Пример #6
0
 public LinearMotor(int forwardGpioPin, int backwardGpioPin, IGpioControllerFacade gpioControllerFacade)
 => InitGpio(forwardGpioPin, backwardGpioPin, gpioControllerFacade);
Пример #7
0
        public YAxis(IDriveSettingRepository driveSettingRepository, IEmergencyStop emergencyStop, IGpioControllerFacade gpioControllerFacade)
            : base(driveSettingRepository, emergencyStop)
        {
            var drivePins = new DrivePins
            {
                EnablePin          = 22,
                DirectionPin       = 5,
                StepPin            = 6,
                ReferenceSwitchPin = 21
            };

            _stepperDriveControl = new StepperDriveControl(drivePins, gpioControllerFacade);

            _defaultDriveSetting = new DriveSetting
            {
                DriveName                 = Name,
                MaxSpeed                  = new Speed(80, SpeedUnit.MillimeterPerSecond),
                Acceleration              = new Acceleration(80, AccelerationUnit.MillimeterPerSecondSquared),
                SpindlePitch              = new Length(8, LengthUnit.Millimeter),
                StepsPerRevolution        = 400,
                SoftwareLimitMinus        = new Length(0.1, LengthUnit.Millimeter),
                SoftwareLimitPlus         = new Length(141.1, LengthUnit.Millimeter),
                ReverseDirection          = false,
                ReferenceDrivingDirection = DrivingDirection.Negative,
                ReferencePosition         = new Length(0, LengthUnit.Millimeter),
                ReferenceDrivingSpeed     = new Speed(3.5, SpeedUnit.MillimeterPerSecond)
            };
        }
Пример #8
0
 public Light(int gpioPin, IGpioControllerFacade gpioControllerFacade)
 {
     _blinkingTokensource = new CancellationTokenSource();
     _gpio = new GpioPin(gpioControllerFacade, gpioPin, PinMode.Output);
     TurnLightOff();
 }
Пример #9
0
 public EmergencyStop(IGpioControllerFacade gpioControllerFacade)
 => InitGpio(emergencyStopGpioPin : 12, gpioControllerFacade);