Ultrasonic distance sensor driver. More...
Macros | |
#define | SONAR_ENABLED 0x01 |
flag to indicate sonar is enabled More... | |
#define | SONAR_INSTALLED 0x02 |
flag to indicate sonar is installed More... | |
#define | SONAR_TIMEOUT 40000 |
Default timeout for sonar, 40mS. More... | |
Enumerations | |
enum | tVexSonnarState { kSonarStatePing = 0, kSonarStateWait, kSonarStateDone, kSonarStateError } |
Internal sonar driver states. More... | |
Functions | |
void | vexSonarAdd (tVexSonarChannel channel, tVexDigitalPin pa, tVexDigitalPin pb) |
Add a sonar to the array of installed sonars. More... | |
void | vexSonarStart (tVexSonarChannel channel) |
Start a sonar by enabling the interrupt port. More... | |
void | vexSonarStop (tVexSonarChannel channel) |
Stop a sonar by disabling the interrupt port. More... | |
void | vexSonarStartAll () |
Enable all installed sonars. More... | |
void | vexSonarRun () |
Start the sonar polling task if at least one sonar is installed. More... | |
void | vexSonarPing (tVexSonarChannel channel) |
Start 10uS pulse to initiate sonar ping. More... | |
int16_t | vexSonarGetCm (tVexSonarChannel channel) |
Get sonar value in cm. More... | |
int16_t | vexSonarGetInch (tVexSonarChannel channel) |
Get sonar value in inches. More... | |
void | vexSonarDebug (vexStream *chp, int argc, char *argv[]) |
Send useful information to debug console. More... | |
Ultrasonic distance sensor driver.
#define SONAR_ENABLED 0x01 |
flag to indicate sonar is enabled
#define SONAR_INSTALLED 0x02 |
flag to indicate sonar is installed
#define SONAR_TIMEOUT 40000 |
Default timeout for sonar, 40mS.
enum tVexSonnarState |
void vexSonarAdd | ( | tVexSonarChannel | channel, |
tVexDigitalPin | pa, | ||
tVexDigitalPin | pb | ||
) |
Add a sonar to the array of installed sonars.
[in] | channel | The sonar channel |
[in] | pa | The first input pin used by the sonar |
[in] | pb | The second input pin used by the sonat |
void vexSonarStart | ( | tVexSonarChannel | channel) |
Start a sonar by enabling the interrupt port.
[in] | channel | The sonar channel |
void vexSonarStop | ( | tVexSonarChannel | channel) |
Stop a sonar by disabling the interrupt port.
[in] | channel | The sonar channel |
void vexSonarStartAll | ( | void | ) |
Enable all installed sonars.
void vexSonarRun | ( | void | ) |
Start the sonar polling task if at least one sonar is installed.
void vexSonarPing | ( | tVexSonarChannel | channel) |
Start 10uS pulse to initiate sonar ping.
[in] | channel | The sonar channel |
int16_t vexSonarGetCm | ( | tVexSonarChannel | channel) |
Get sonar value in cm.
[in] | channel | The sonar channel |
int16_t vexSonarGetInch | ( | tVexSonarChannel | channel) |
Get sonar value in inches.
[in] | channel | The sonar channel |
void vexSonarDebug | ( | vexStream * | chp, |
int | argc, | ||
char * | argv[] | ||
) |
Send useful information to debug console.
[in] | chp | A pointer to a vexStream object |
[in] | argc | The number of command line arguments |
[in] | argv | An array of pointers to the command line args |