private async void Page_Loaded(object sender, RoutedEventArgs e) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); ParametresPortSerie parametresGps = new ParametresPortSerie("", @"\\?\ACPI#BCM2837#4#", 9600, SerialParity.None, SerialStopBitCount.One, 8, SerialHandshake.None, 100, 0); _gps = new GpsNMEA(parametresGps, true, 1024); InfosGpsCTRL.DataContext = new GpsNMEAVM(_gps); GpioController gpc = GpioController.GetDefault(); GpioPin ledOccupe = gpc?.OpenPin(24); try { _appareilPhoto = new AppareilPhotoGps(ledOccupe, _gps); if (await _appareilPhoto.Initialiser(1280, 960, "MJPG")) { PrendrePhotoBTN.Visibility = Visibility.Visible; if (gpc != null) { _poussoirDecl = gpc.OpenPin(18); _poussoirDecl.SetDriveMode(GpioPinDriveMode.InputPullUp); _poussoirDecl.DebounceTimeout = new TimeSpan(0, 0, 0, 0, 5); _poussoirDecl.ValueChanged += _poussoirDecl_ValueChanged; _ledEnMarche = gpc.OpenPin(23); _ledEnMarche.SetDriveMode(GpioPinDriveMode.Output); _ledEnMarche.Write(GpioPinValue.High); } } } finally { PeripheriqueSerie.PeripheriquesSerie.DemarrerSurveillance(); } }
private async void Page_Loaded(object sender, RoutedEventArgs e) { GpioController gpc = GpioController.GetDefault(); GpioPin ledOccupe = gpc?.OpenPin(24); _appareilPhoto = new AppareilPhoto(ledOccupe); if (await _appareilPhoto.Initialiser(1280, 960, "MJPG")) { PrendrePhotoBTN.Visibility = Visibility.Visible; if (gpc != null) { _poussoirDecl = gpc.OpenPin(18); _poussoirDecl.SetDriveMode(GpioPinDriveMode.InputPullUp); _poussoirDecl.DebounceTimeout = new TimeSpan(0, 0, 0, 0, 5); _ledEnMarche = gpc.OpenPin(23); _ledEnMarche.SetDriveMode(GpioPinDriveMode.Output); _ledEnMarche.Write(GpioPinValue.High); } } }