private async void InitializeLedArray() { const byte address = 0x46; var device = await I2cHelper.GetI2cDevice(address); if (device != null) { ledArray = new LedArray(device); } }
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); }
private async Task InitializeLedArray() { const byte address = 0x46; var device = await I2cHelper.GetI2cDevice(address); if (device != null) { ledArray = new LedArray(device); ButtonPreview_Click(null, null); } }
public MainPage() { this.InitializeComponent(); this.InitializeApplicationAsync(); try { _ledcontrol = new I2cHelper(); _isI2cIntialized = true; } catch { _isI2cIntialized = false; } }
private async Task InitializeLedArray() { const byte address = 0x46; var device = await I2cHelper.GetI2cDevice(address); if (device != null) { ledArray = new LedArray(device); ledArray.Reset(Colors.Black); } else { DiagnosticInfo.Display(null, "Led array unavailable"); } }
public async Task <bool> Initialize() { device = await I2cHelper.GetI2cDevice(sensorAddress); if (device != null) { IsInitialized = WhoAmI(whoAmIRegisterAddress, whoAmIDefaultValue); if (IsInitialized) { Configure(); } } return(IsInitialized); }
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; }
private const int hzOscillatorFrequency = (int)25e+6; // 25 MHz public async Task Init(byte address = defaultAddress) { device = await I2cHelper.GetI2cDevice(address); IsInitialized = device != null; }