public StatusLamp(IStatusLampSettingRepository statusLampSettingRepository, IGpioControllerFacade gpioControllerFacade) { _name = "StatusLamp"; _statusLampSettingRepository = statusLampSettingRepository; _redLight = new Light(gpioPin: 19, gpioControllerFacade: gpioControllerFacade); _greenLight = new Light(gpioPin: 13, gpioControllerFacade: gpioControllerFacade); }
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); } }
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); }
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; }
private void InitGpio(int forwardGpioPin, int backwardGpioPin, IGpioControllerFacade gpioControllerFacade) { _forwardPin = new GpioPin(gpioControllerFacade, forwardGpioPin, PinMode.Output); _backwardPin = new GpioPin(gpioControllerFacade, backwardGpioPin, PinMode.Output); StopMotor(); }
public LinearMotor(int forwardGpioPin, int backwardGpioPin, IGpioControllerFacade gpioControllerFacade) => InitGpio(forwardGpioPin, backwardGpioPin, gpioControllerFacade);
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) }; }
public Light(int gpioPin, IGpioControllerFacade gpioControllerFacade) { _blinkingTokensource = new CancellationTokenSource(); _gpio = new GpioPin(gpioControllerFacade, gpioPin, PinMode.Output); TurnLightOff(); }
public EmergencyStop(IGpioControllerFacade gpioControllerFacade) => InitGpio(emergencyStopGpioPin : 12, gpioControllerFacade);