| ||||||
Files | |
| file | lego-ultrasound.h |
SMUX driver for the Lego US sensor. | |
Defines | |
| #define | LEGOUS_I2C_ADDR 0x02 |
| #define | LEGOUS_REG_CMD 0x41 |
| #define | LEGOUS_REG_DATA 0x42 |
| #define | LEGOUS_CMD_OFF 0x00 |
| #define | LEGOUS_CMD_SSHOT 0x01 |
| #define | LEGOUS_CMD_CONT 0x02 |
| #define | LEGOUS_CMD_ECAPT 0x03 |
| #define | LEGOUS_CMD_RST 0x04 |
Functions | |
| int | USreadDist (tSensors link) |
| bool | USreadDistances (tSensors link, tByteArray &distances) |
| bool | _USsendCmd (tSensors link, ubyte command) |
| bool | USsetSingleMode (tSensors link) |
| bool | USsetContinuousMode (tSensors link) |
| bool | USsetOff (tSensors link) |
| bool | USsetEventCapture (tSensors link) |
| bool | USreset (tSensors link) |
| int | USreadDist (tMUXSensor muxsensor) |
Variables | |
| tConfigParams | LEGOUS_config = {HTSMUX_CHAN_I2C + HTSMUX_CHAN_9V + HTSMUX_CHAN_I2C_SLOW, 1, 0x02, 0x42} |
| tByteArray | LEGOUS_I2CRequest |
| tByteArray | LEGOUS_I2CReply |
Ultrasonic Sensor
| #define LEGOUS_CMD_CONT 0x02 |
Command to turn on Continuous Mode
Definition at line 45 of file lego-ultrasound.h.
| #define LEGOUS_CMD_ECAPT 0x03 |
Command to turn on Event Capture Mode
Definition at line 46 of file lego-ultrasound.h.
| #define LEGOUS_CMD_OFF 0x00 |
Command to switch US off
Definition at line 43 of file lego-ultrasound.h.
| #define LEGOUS_CMD_RST 0x04 |
Command to request a warm reset
Definition at line 47 of file lego-ultrasound.h.
| #define LEGOUS_CMD_SSHOT 0x01 |
Command to turn on Single Shot mode
Definition at line 44 of file lego-ultrasound.h.
| #define LEGOUS_I2C_ADDR 0x02 |
Lego US I2C address
Definition at line 39 of file lego-ultrasound.h.
| #define LEGOUS_REG_CMD 0x41 |
Command register
Definition at line 40 of file lego-ultrasound.h.
| #define LEGOUS_REG_DATA 0x42 |
Start of measurement data registers
Definition at line 41 of file lego-ultrasound.h.
| bool _USsendCmd | ( | tSensors | link, |
| ubyte | command | ||
| ) |
Send a command to the US Sensor
Note: this is an internal function and should not be called directly.
| link | the US port number |
| command | the command to be sent to the sensor |
Definition at line 138 of file lego-ultrasound.h.
| int USreadDist | ( | tMUXSensor | muxsensor ) |
Get the distance value from the sensor
| muxsensor | the SMUX sensor port number |
Definition at line 74 of file lego-ultrasound.h.
| int USreadDist | ( | tSensors | link ) |
Get the distance values from the sensor
| link | the US port number |
Definition at line 94 of file lego-ultrasound.h.
| bool USreadDistances | ( | tSensors | link, |
| tByteArray & | distances | ||
| ) |
Get the distance values from the sensor. The distances to the 8 closest objects are returned.
| link | the US port number |
| distances | array holding data on last 8 echos received |
Definition at line 115 of file lego-ultrasound.h.
| bool USreset | ( | tSensors | link ) |
Request a warm reset of the sensor.
| link | the US port number |
Definition at line 195 of file lego-ultrasound.h.
| bool USsetContinuousMode | ( | tSensors | link ) |
Configure the US sensor for Continuous Mode. This is the default.
| link | the US port number |
Definition at line 165 of file lego-ultrasound.h.
| bool USsetEventCapture | ( | tSensors | link ) |
Configure the US sensor for Event Capture mode
| link | the US port number |
Definition at line 185 of file lego-ultrasound.h.
| bool USsetOff | ( | tSensors | link ) |
Turn the sensor off.
| link | the US port number |
Definition at line 175 of file lego-ultrasound.h.
| bool USsetSingleMode | ( | tSensors | link ) |
Configure the US sensor for Single Shot mode
| link | the US port number |
Definition at line 155 of file lego-ultrasound.h.
| tConfigParams LEGOUS_config = {HTSMUX_CHAN_I2C + HTSMUX_CHAN_9V + HTSMUX_CHAN_I2C_SLOW, 1, 0x02, 0x42} |
Array to hold SMUX config data for sensor
Definition at line 62 of file lego-ultrasound.h.
Definition at line 66 of file lego-ultrasound.h.
Definition at line 65 of file lego-ultrasound.h.
1.7.2