示例#1
0
        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);
        }
示例#4
0
 /// <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));
 }
示例#5
0
文件: Adc.cs 项目: nunanas21/CIS-109
 private async Task Init()
 {
     controller             = (await AdcController.GetControllersAsync(AdcMcp3008Provider.GetAdcProvider()))[0];
     controller.ChannelMode = mode;
 }