public class ADXL345_SPI extends SensorBase implements Accelerometer, Sendable
Modifier and Type | Class and Description |
---|---|
static class |
ADXL345_SPI.AllAxes |
static class |
ADXL345_SPI.Axes |
Accelerometer.Range
Modifier and Type | Field and Description |
---|---|
protected SPI |
m_spi |
kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond
Constructor and Description |
---|
ADXL345_SPI(SPI.Port port,
Accelerometer.Range range)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Free the resources used by this object.
|
double |
getAcceleration(ADXL345_SPI.Axes axis)
Get the acceleration of one axis in Gs.
|
ADXL345_SPI.AllAxes |
getAccelerations()
Get the acceleration of all axes in Gs.
|
double |
getX()
Common interface for getting the x axis acceleration.
|
double |
getY()
Common interface for getting the y axis acceleration.
|
double |
getZ()
Common interface for getting the z axis acceleration.
|
void |
initSendable(SendableBuilder builder)
Initializes this
Sendable object. |
void |
setRange(Accelerometer.Range range)
Common interface for setting the measuring range of an accelerometer.
|
checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule
addChild, getName, getSubsystem, setName, setName, setName, setSubsystem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getSubsystem, setName, setName, setSubsystem
public ADXL345_SPI(SPI.Port port, Accelerometer.Range range)
port
- The SPI port that the accelerometer is connected torange
- The range (+ or -) that the accelerometer will measure.public void free()
SendableBase
free
in class SendableBase
public void setRange(Accelerometer.Range range)
Accelerometer
setRange
in interface Accelerometer
range
- The maximum acceleration, positive or negative, that the accelerometer will
measure. Not all accelerometers support all ranges.public double getX()
Accelerometer
getX
in interface Accelerometer
public double getY()
Accelerometer
getY
in interface Accelerometer
public double getZ()
Accelerometer
getZ
in interface Accelerometer
public double getAcceleration(ADXL345_SPI.Axes axis)
axis
- The axis to read from.public ADXL345_SPI.AllAxes getAccelerations()
public void initSendable(SendableBuilder builder)
Sendable
Sendable
object.initSendable
in interface Sendable
builder
- sendable builder