Open Storm
Functions
ultrasonic.c File Reference

Implements functions for maxbotix ultrasonic sensors and senix toughsonic sensors subroutines. More...

#include "ultrasonic.h"
Include dependency graph for ultrasonic.c:

Functions

uint8 ultrasonic_power_on (uint8 which_ultrasonic)
 Powers on the ultrasonic sensor. More...
 
uint8 ultrasonic_power_off (uint8 which_ultrasonic)
 Powers off the ultrasonic sensor. More...
 
uint8 ultrasonic_get_reading (UltrasonicReading *reading, uint8_t which_ultrasonic)
 Takes a reading with the ultrasonic sensor selected by which_ultrasonic. More...
 
uint8 zip_ultrasonic (char *labels[], float readings[], uint8 *array_ix, uint8 which_ultrasonic, uint8 take_average, int ultrasonic_loops, uint8 max_size)
 Inserts current values of ultrasonic_reading into labels and readings arrays. More...
 

Detailed Description

Implements functions for maxbotix ultrasonic sensors and senix toughsonic sensors subroutines.

Author
Brandon Wong, Matt Bartos, Ivan Mondragon, Alec Beljanski
Version
TODO
Date
2017-06-19

Function Documentation

uint8 ultrasonic_get_reading ( UltrasonicReading reading,
uint8_t  which_ultrasonic 
)

Takes a reading with the ultrasonic sensor selected by which_ultrasonic.

Parameters
readingStructure to store results into. Depth in millimeters.
which_ultrasonicWhich ultrasonic sensor to use to take reading:
  • 0: First ultrasonic sensor
  • 1: Second ultrasonic sensor
  • 2: Senix toughsonic sensor
Returns
1 on success, 0 otherwise.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8 ultrasonic_power_off ( uint8  which_ultrasonic)

Powers off the ultrasonic sensor.

Parameters
which_ultrasonicWhich ultrasonic sensor to power off:
  • 0: First ultrasonic sensor
  • 1: Second ultrasonic sensor
  • 2: Senix toughsonic sensor
Returns
0 on success

Here is the call graph for this function:

Here is the caller graph for this function:

uint8 ultrasonic_power_on ( uint8  which_ultrasonic)

Powers on the ultrasonic sensor.

Parameters
which_ultrasonicWhich ultrasonic sensor to power on:
  • 0: First ultrasonic sensor
  • 1: Second ultrasonic sensor
  • 2: Senix toughsonic sensor
Returns
1 on success

Here is the caller graph for this function:

uint8 zip_ultrasonic ( char *  labels[],
float  readings[],
uint8 *  array_ix,
uint8  which_ultrasonic,
uint8  take_average,
int  ultrasonic_loops,
uint8  max_size 
)

Inserts current values of ultrasonic_reading into labels and readings arrays.

Parameters
labelsArray to store labels corresponding to each sensor reading
readingsArray to store sensor readings as floating point values
array_ixArray index to label and readings
which_ultrasonicWhich ultrasonic to take reading with:
  • 0: First ultrasonic sensor
  • 1: Second ultrasonic sensor
  • 2: Senix toughsonic sensor
take_averageWhether to take average or not
  • 0: Take first valid reading
  • 1: Take average of valid readings
ultrasonic_loopsNumber of readings taken on each call.
max_sizeMaximum size of label and reading arrays (number of entries)
Returns
(*array_ix) + number of entries filled

Here is the call graph for this function:

Here is the caller graph for this function: