Unfinished v0.7, added bearing detection
Fork of Pi_Swarm_Library_v06_alpha by
Diff: piswarm.h
- Revision:
- 9:7a4fc1d7e484
- Parent:
- 6:69a48b1ec3af
- Child:
- 10:5c111c07a2ed
--- a/piswarm.h Mon Feb 03 12:59:51 2014 +0000 +++ b/piswarm.h Tue Feb 18 17:14:03 2014 +0000 @@ -4,7 +4,11 @@ * * (C) Dr James Hilder, Dept. Electronics & Computer Science, University of York * - * Version 0.5 February 2014 + * Version 0.6 February 2014 + * + * Change notes: + * 0.6 : Added new IR sensor functions to improve efficiency (see manual for details) + * 0.5 : Initial release * * Designed for use with the Pi Swarm Board (enhanced MBED sensor board) v1.2 * @@ -140,6 +144,34 @@ // Returns an approximate distance of any reflected obstacle in front of the given IR sensor (in millimeters, range 0 - 100) float read_reflected_ir_distance ( char index ); + // Returns the stored value of the reflected obstacle based on last call of either read_reflected_ir_distance or store_reflected_distances + // Introduced in API 0.6 + float get_reflected_ir_distance ( char index ); + + // Returns the stored value of the non-illuminated sensor based on last call of store_background_raw_ir_values + // Introduced in API 0.6 + unsigned short get_background_raw_ir_value ( char index ); + + // Returns the stored value of the illuminated sensor based on last call of store_illuminated_raw_ir_values + // Introduced in API 0.6 + unsigned short get_illuminated_raw_ir_value ( char index ); + + // Stores the reflected distances for all 8 IR sensors + // Introduced in API 0.6 + void store_reflected_ir_distances ( void ); + + // Stores the raw ADC values for all 8 IR sensors without enabling IR emitters + // Introduced in API 0.6 + void store_background_raw_ir_values ( void ); + + // Stores the raw ADC values for all 8 IR sensors with a 500us emitter pulse + // Introduced in API 0.6 + void store_illuminated_raw_ir_values ( void ); + + // Converts a background and illuminated value into a distance + // Introduced in API 0.6 - used by read_reflected_ir_distance and store_reflected_ir_distances + float calculate_reflected_distance ( unsigned short background_value, unsigned short illuminated_value ); + // Returns the illuminated raw ADC value for a given IR sensor (500us pulse) unsigned short read_illuminated_raw_ir_value ( char index ); @@ -313,7 +345,7 @@ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Native m3Pi Functions - // These should preserve functionality of (most) m3pi code but may be fully functional on Pi Swarm + // These should preserve functionality of (most) m3pi code but may not be fully functional on Pi Swarm ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Force a hardware reset of the 3-pi