New Analog API Proposal ***averaging stuff*** new analog init function - don't worry about speeding up analog loop for now (do that separately) - will take the number of samples for averaging as an argument - make old init function a wrapper for this one that uses a default value - will not handle multiple buffer lengths - initialize averaging buffers - bitfield (or some other way) to determine which ADC ports to average new "get" functions - take an argument to specify average or immediate value - if averaging, perform division on running sum - deprecate the old get #define some new error codes - out of range - trying to average, but not enough history values in the interrupt - fill the ring buffer with the newest reading and add the current readings for the average - don't do the divide for the averaging - do this in get update rangefinder code accordingly so that people can get averaged rangefinders ***new analog interrupt*** init function -takes a bitfield of different analog fields to read -analog loop only reads those analog fields new "get" function -keep it fresh - return an error if somebody tries to read an old value twice function to update the bitfield dynamically eliminate bom_refresh - put bom refresh in the analog loop when the bom bit is asserted in the bitfield #define some new error codes - analog port not initialized yet - not reading from that analog - bit not asserted in bitfield - reading is not fresh - this particular reading has already been read no need to start and stop the loop anymore - deprecate the old functions - to do this, user should set all bits in bitfield to 0 issues to consider: - concurrency issue if user disables a port that is currently being read (is this serious?)