|
Files | |
file | hitechnic-compass.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 53 of file hitechnic-compass.h.
#define HTMC_HEAD_L 0x43 |
HTMC Heading Lower bit
Definition at line 49 of file hitechnic-compass.h.
#define HTMC_HEAD_U 0x42 |
HTMC Heading Upper bits
Definition at line 48 of file hitechnic-compass.h.
#define HTMC_I2C_ADDR 0x02 |
HTMC I2C device address
Definition at line 46 of file hitechnic-compass.h.
#define HTMC_MEASURE_CMD 0x00 |
HTMC measurement mode command
Definition at line 52 of file hitechnic-compass.h.
#define HTMC_MODE 0x41 |
HTMC Mode control
Definition at line 47 of file hitechnic-compass.h.
int HTMCreadHeading | ( | tSensors | link ) |
Return the current absolute heading
link | the HTMC port number |
Definition at line 132 of file hitechnic-compass.h.
int HTMCreadHeading | ( | tMUXSensor | muxsensor ) |
Return the current absolute heading
muxsensor | the SMUX sensor port number |
Definition at line 153 of file hitechnic-compass.h.
int HTMCreadRelativeHeading | ( | tSensors | link ) |
Return the current relative heading, value between -179 and 180
link | the HTMC port number |
Definition at line 174 of file hitechnic-compass.h.
int HTMCreadRelativeHeading | ( | tMUXSensor | muxsensor ) |
Return the current relative heading, value between -179 and 180
muxsensor | the SMUX sensor port number |
Definition at line 188 of file hitechnic-compass.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 206 of file hitechnic-compass.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 219 of file hitechnic-compass.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 87 of file hitechnic-compass.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 106 of file hitechnic-compass.h.
tConfigParams HTMC_config = {HTSMUX_CHAN_I2C, 2, 0x02, 0x42} |
Array to hold SMUX config data for sensor
Definition at line 66 of file hitechnic-compass.h.
Array to hold I2C reply data
Definition at line 70 of file hitechnic-compass.h.
Array to hold I2C command data
Definition at line 69 of file hitechnic-compass.h.
int target[][] |
{{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
Definition at line 72 of file hitechnic-compass.h.