public class HiTechnicNxtCompassSensor extends I2cControllerPortDeviceImpl implements CompassSensor, I2cController.I2cPortReadyCallback
CompassSensor.CompassMode
HardwareDevice.Manufacturer
Modifier and Type | Field and Description |
---|---|
static byte |
CALIBRATION |
static byte |
CALIBRATION_FAILURE |
static int |
COMPASS_BUFFER |
static int |
COMPASS_BUFFER_SIZE |
static byte |
DIRECTION_END |
static byte |
DIRECTION_START |
static byte |
HEADING_IN_TWO_DEGREE_INCREMENTS |
static int |
HEADING_WORD_LENGTH |
static I2cAddr |
I2C_ADDRESS |
static double |
INVALID_DIRECTION |
static byte |
MEASUREMENT |
static byte |
MODE_CONTROL_ADDRESS |
static byte |
ONE_DEGREE_HEADING_ADDER |
controller, physicalPort
Constructor and Description |
---|
HiTechnicNxtCompassSensor(I2cController module,
int physicalPort) |
Modifier and Type | Method and Description |
---|---|
boolean |
calibrationFailed()
Check to see whether calibration was successful.
|
void |
close()
Closes this device
|
protected void |
controllerNowArmedOrPretending()
intended as a subclass hook
|
java.lang.String |
getConnectionInfo()
Get connection information about this device in a human readable format
|
java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
double |
getDirection()
Get the current direction, in degrees, in the range [0, 360).
|
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
int |
getVersion()
Version
|
void |
portIsReady(int port) |
void |
resetDeviceConfigurationForOpMode()
Resets the device's configuration to that which is expected at the beginning of an OpMode.
|
void |
setMode(CompassSensor.CompassMode mode)
Change to calibration or measurement mode
|
java.lang.String |
status()
Status of this sensor, in string form
|
java.lang.String |
toString() |
controllerNowDisarmed, finishConstruction, getI2cController, getPort, onModuleStateChange
public static final I2cAddr I2C_ADDRESS
public static final byte MODE_CONTROL_ADDRESS
public static final byte CALIBRATION
public static final byte MEASUREMENT
public static final byte HEADING_IN_TWO_DEGREE_INCREMENTS
public static final byte ONE_DEGREE_HEADING_ADDER
public static final byte CALIBRATION_FAILURE
public static final byte DIRECTION_START
public static final byte DIRECTION_END
public static final double INVALID_DIRECTION
public static final int HEADING_WORD_LENGTH
public static final int COMPASS_BUFFER
public static final int COMPASS_BUFFER_SIZE
public HiTechnicNxtCompassSensor(I2cController module, int physicalPort)
protected void controllerNowArmedOrPretending()
I2cControllerPortDeviceImpl
controllerNowArmedOrPretending
in class I2cControllerPortDeviceImpl
public java.lang.String toString()
toString
in class java.lang.Object
public double getDirection()
CompassSensor
getDirection
in interface CompassSensor
public java.lang.String status()
CompassSensor
status
in interface CompassSensor
public void setMode(CompassSensor.CompassMode mode)
CompassSensor
setMode
in interface CompassSensor
public boolean calibrationFailed()
CompassSensor
calibrationFailed
in interface CompassSensor
public void portIsReady(int port)
portIsReady
in interface I2cController.I2cPortReadyCallback
public HardwareDevice.Manufacturer getManufacturer()
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()
HardwareDevice
close
in interface HardwareDevice