项目概述
最后…… 这里是一些演示代码允许您轻松地使用startKIT adc。 我试图尽可能MCU-like API。
是一个简单的应用程序,包括灯相对应的发光二极管4 ADC输入成正比的ADC值。
驱动包含链接设置魔法,所以ADC功能/调试和运行时还在闪烁。
别忘了让xscope I / O(在GUI或运行配置——xscope提示)查看控制台输出。
享受与模拟世界! 我也会看得到这inetgarted例子. .
从adc.h:
//adc.h for startKIT written by infiniteimprobability (xcore.com) June 2014
//
//Contains ADC task and ADC interface definition
//
//Aims to present the U8A/startKIT ADC in an MCU-like manner by abstracting away
//channels, link setup (for startKIT FLASH boot) and trigger requirements.
//
//Enables all 4 channels and provides simple API for trigger, read and conversion complete event
//Practical fastest sample rate (to aquire all 4 channels) with all cores running flat-out
//is about 50us (to trigger, aquire, notify and read). So about 20KHz. Assumes core sharing with GPIO (slower)
//Ie. This module is built for comfort rather than speed. Give it it's own core and only run 4 cores total,
//and this number jumps to about 6us, or about 165KHz. Much closer to max theoritcal b/w of 1MHz/4 = 250KHz
//
//Runs in two modes (self tiggering periodically or trigger on request). Trigger function still callable
//in periodic mode and conversion finished notfication available in period mode if needed. Task is combinable
//so you can run it with other low speed tasks in the same logical core! (eg. GPIO)
//
//License = do what you like with it! But please post your projects on xcore