예제 #1
0
 private async void homeButton_Tapped(object sender, TappedRoutedEventArgs e)
 {
     ShowLockScreen.Begin();
     homeButton.IsTapEnabled = false;
     backButton.IsTapEnabled = true;
     await I2cHelper.WriteRead(new Models.Slave()
     {
         I2cAddress = 8
     }, I2cHelper.Mode.Mode1);
 }
예제 #2
0
파일: App.xaml.cs 프로젝트: isammour/LUCT
        private async void Timer_Tick(object sender, object e)
        {
            await I2cHelper.WriteRead(new Models.Slave()
            {
                I2cAddress = 8
            }, I2cHelper.Mode.Mode1, 0, 0);

            //int s1 = 0, s2 = 0;
            //if (AppKeys.Switch1 == true)
            //    s1 = 1;
            //if (AppKeys.Switch2 == true)
            //    s2 = 1;
            await I2cHelper.Read(new Models.Slave()
            {
                I2cAddress = 9
            });

            if (switch1 == 1)
            {
                AppKeys.Switch1 = false;
            }
            if (switch2 == 1)
            {
                AppKeys.Switch2 = false;
            }
            await I2cHelper.WriteRead(new Models.Slave()
            {
                I2cAddress = 9
            }, I2cHelper.Mode.Mode1, 0, 0, new I2cHelper.SmsSlaveModel()
            {
                Sflag   = 0,
                SmsSend = 0,
                Switch1 = AppKeys.Switch1 ? 1 : 0,
                Switch2 = AppKeys.Switch2 ? 1 :0,
            });

            Debug.WriteLine(AppKeys.Switch1 + "From timer switch 1");
            Debug.WriteLine(AppKeys.Switch2 + "From timer switch 2");
            switch1 = AppKeys.Switch1 ? 1 : 0;
            switch2 = AppKeys.Switch2 ? 1 : 0;
        }