|
Files | |
file | HTMC-driver.h |
HiTechnic Magnetic Compass Sensor Driver. | |
Defines | |
#define | HTMC_I2C_ADDR 0x02 |
#define | HTMC_MODE 0x41 |
#define | HTMC_HEAD_U 0x42 |
#define | HTMC_HEAD_L 0x43 |
#define | HTMC_MEASURE_CMD 0x00 |
#define | HTMC_CALIBRATE_CMD 0x43 |
Functions | |
bool | HTMCstartCal (tSensors link) |
bool | HTMCstopCal (tSensors link) |
int | HTMCreadHeading (tSensors link) |
int | HTMCreadRelativeHeading (tSensors link) |
int | HTMCsetTarget (tSensors link, int offset=0) |
int | HTMCreadHeading (tMUXSensor muxsensor) |
int | HTMCreadRelativeHeading (tMUXSensor muxsensor) |
int | HTMCsetTarget (tMUXSensor muxsensor, int offset=0) |
Variables | |
tConfigParams | HTMC_config = {HTSMUX_CHAN_I2C, 2, 0x02, 0x42} |
tByteArray | HTMC_I2CRequest |
tByteArray | HTMC_I2CReply |
int | target [][] |
HiTechnic Compass Sensor
#define HTMC_CALIBRATE_CMD 0x43 |
HTMC calibrate mode command
Definition at line 52 of file HTMC-driver.h.
#define HTMC_HEAD_L 0x43 |
HTMC Heading Lower bit
Definition at line 48 of file HTMC-driver.h.
#define HTMC_HEAD_U 0x42 |
HTMC Heading Upper bits
Definition at line 47 of file HTMC-driver.h.
#define HTMC_I2C_ADDR 0x02 |
HTMC I2C device address
Definition at line 45 of file HTMC-driver.h.
#define HTMC_MEASURE_CMD 0x00 |
HTMC measurement mode command
Definition at line 51 of file HTMC-driver.h.
#define HTMC_MODE 0x41 |
HTMC Mode control
Definition at line 46 of file HTMC-driver.h.
int HTMCreadHeading | ( | tSensors | link ) |
Return the current absolute heading
link | the HTMC port number |
Definition at line 134 of file HTMC-driver.h.
int HTMCreadHeading | ( | tMUXSensor | muxsensor ) |
Return the current absolute heading
muxsensor | the SMUX sensor port number |
Definition at line 158 of file HTMC-driver.h.
int HTMCreadRelativeHeading | ( | tSensors | link ) |
Return the current relative heading, value between -179 and 180
link | the HTMC port number |
Definition at line 179 of file HTMC-driver.h.
int HTMCreadRelativeHeading | ( | tMUXSensor | muxsensor ) |
Return the current relative heading, value between -179 and 180
muxsensor | the SMUX sensor port number |
Definition at line 193 of file HTMC-driver.h.
int HTMCsetTarget | ( | tSensors | link, |
int | offset | ||
) |
Set the value for the offset to be used as the new zero-point for the relative heading returned by HTMCreadRelativeHeading()
link | the HTMC port number |
offset | to be used to calculate relative heading (0-360 degrees). If unspecified, uses current heading. |
Definition at line 211 of file HTMC-driver.h.
int HTMCsetTarget | ( | tMUXSensor | muxsensor, |
int | offset | ||
) |
Set the value for the offset to be used as the new zero-point for the relative heading returned by HTMCreadRelativeHeading()
muxsensor | the SMUX sensor port number |
offset | to be used to calculate relative heading (0-360 degrees). If unspecified, uses current heading. |
Definition at line 224 of file HTMC-driver.h.
bool HTMCstartCal | ( | tSensors | link ) |
Start the calibration. The sensor should be rotated a little more than 360 along the horizontal plane in no less than 20 seconds. After the sensor has been rotated, call HTMCstopCal() to set the sensor back in measurement mode and save the calibration data. This calibration data is stored in the sensor until the next calibration.
link | the HTMC port number |
Definition at line 86 of file HTMC-driver.h.
bool HTMCstopCal | ( | tSensors | link ) |
Stop the calibration. This should be called no less than 20 seconds after HTMCstartCal() and only if the sensor has been rotated more than 360 degrees
link | the HTMC port number |
Definition at line 105 of file HTMC-driver.h.
tConfigParams HTMC_config = {HTSMUX_CHAN_I2C, 2, 0x02, 0x42} |
Array to hold SMUX config data for sensor
Definition at line 65 of file HTMC-driver.h.
Array to hold I2C reply data
Definition at line 69 of file HTMC-driver.h.
Array to hold I2C command data
Definition at line 68 of file HTMC-driver.h.
int target[][] |
{{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
Definition at line 71 of file HTMC-driver.h.