public MainPage() { this.InitializeComponent(); // Driver for PCA9685 pwmDriver = new PCA9685(); pwmDriver.SetDesiredFrequency(60); // Driver for L298N dcMotorDriver = new L298N(new L298NMotors { ENPin = PCA9685_DC1_Pin, INAPin = DCInputAPin, INBPin = DCInputBPin }, new L298NMotors { ENPin = PCA9685_DC2_Pin, INAPin = DCInputCPin, INBPin = DCInputDPin }, pwmDriver); // Driver for ULN2003 stepMotorDriver = new ULN2003(Step_IN1, Step_IN2, Step_IN3, Step_IN4); stopwatch = new Stopwatch(); this.Unloaded += MainPage_Unloaded; // Buggy control StepsProgressGuage.HighFontSize = 30; }
public void Setup() { //Enable 5V Control GpioController gpioController = A.Dummy <GpioController>(); FakeItEasy.Fake.GetFakeManager(gpioController); var generalPurposeInputOutputController = A.Fake <GeneralPurposeInputOutputController>(options => new GeneralPurposeInputOutputController(gpioController)); List <IController> motorControllerInitObjects = new List <IController>() { generalPurposeInputOutputController }; MotorController = A.Fake <L298N>(options => options.WithArgumentsForConstructor(() => new L298N(generalPurposeInputOutputController))); MotorController.ChannelAlphaId = new ComponentChannel("LeftChannel"); MotorController.ChannelBetaId = new ComponentChannel("RightChannel"); var channelAMotor1 = GenerateMotor(MotorController.ChannelAlphaId, "FrontLeft", PositionLocation.FrontLeft); var channelBMotor1 = GenerateMotor(MotorController.ChannelBetaId, "FrontRight", PositionLocation.FrontRight); A.CallTo(() => gpioController.GetPinMode(channelAMotor1.DrivePin.Value.PinNumber)).Returns(PinMode.Output); MotorController.Motors.Add(channelAMotor1); MotorController.Motors.Add(channelBMotor1); }