private async Task InitAdc() { var list = await AdcController.GetControllersAsync(PicAdcProvider.Instance); var controller = list[0]; _channel = controller.OpenChannel(0); _timer.Start(); }
public MainPage() { this.InitializeComponent(); // Create a new SpeechSynthesizer instance for later use. synthesizer = new SpeechSynthesizer(); // Initialize the ADC chip for use adcController = (await AdcController.GetControllersAsync(AdcMcp3008Provider.GetAdcProvider()))[0]; LowPotAdcChannel = adcController.OpenChannel(LowPotentiometerADCChannel); HighPotAdcChannel = adcController.OpenChannel(HighPotentiometerADCChannel); CdsAdcChannel = adcController.OpenChannel(CDSADCChannel); }
//private readonly SpiDevice _myDevice; private Mcp3208SpiDevice() { _controller = AdcController.GetControllersAsync(new MCP3208()).AsTask().Result.First(); _tSource = new CancellationTokenSource(); ReadVals(_tSource.Token); }
/// <summary> /// Gets the <see cref="AdcController"/> instances for each controller provider. /// </summary> /// <returns> /// An <see cref="IAsyncOperation{TResult}"/> that yields the list of controllers. /// </returns> public IAsyncOperation <IReadOnlyList <AdcController> > GetControllersAsync() { return(AdcController.GetControllersAsync(this)); }
private async Task Init() { controller = (await AdcController.GetControllersAsync(AdcMcp3008Provider.GetAdcProvider()))[0]; controller.ChannelMode = mode; }