|
Re: Using VEX Ultrasonic Sensor
There used to be a set of (horribly written) vis in WPIlib to support an ultrasonic encoder with two digital ping/response lines. I believe they still exist, but I'm not sure.
It used the DIO Pulse feature and DIO Interrupt features to generate and listen to a pulse. Unfortunately, it was written to Wait On Interrupt, causing the thread that called the ultrasonic sensor to hang until either a pulse was returned, or the timeout (60ms) was reached.
Unfortunately, the majority of the library is written synchronously with blocking calls like this, which is IMHO really really bad embedded code design.
The FPGA has a lot of rarely or never used features which I have never seen used, including these DIO pulse and interrupt features, and a lot of DMA capabilities.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
|