"

2013 FRC Java API

"

edu.wpi.first.wpilibj
Class ADXL345_SPI

java.lang.Object
  extended by edu.wpi.first.wpilibj.SensorBase
      extended by edu.wpi.first.wpilibj.ADXL345_SPI

public class ADXL345_SPI
extends SensorBase

Author:
dtjones, mwills

Nested Class Summary
static class ADXL345_SPI.AllAxes
           
static class ADXL345_SPI.Axes
           
static class ADXL345_SPI.DataFormat_Range
           
 
Field Summary
 
Fields inherited from class edu.wpi.first.wpilibj.SensorBase
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond
 
Constructor Summary
ADXL345_SPI(DigitalOutput cs, ADXL345_SPI.DataFormat_Range range)
          Constructor.
ADXL345_SPI(DigitalOutput clk, DigitalOutput mosi, DigitalInput miso, DigitalOutput cs, ADXL345_SPI.DataFormat_Range range)
          Constructor.
ADXL345_SPI(int slot, int csChannel, ADXL345_SPI.DataFormat_Range range)
          Constructor.
ADXL345_SPI(int slot, int clkChannel, int mosiChannel, int misoChannel, int csChannel, ADXL345_SPI.DataFormat_Range range)
          Constructor.
 
Method Summary
 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.
 
Methods inherited from class edu.wpi.first.wpilibj.SensorBase
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ADXL345_SPI

public ADXL345_SPI(DigitalOutput clk,
                   DigitalOutput mosi,
                   DigitalInput miso,
                   DigitalOutput cs,
                   ADXL345_SPI.DataFormat_Range range)
Constructor. Use this when the device is the first/only device on the bus

Parameters:
clk - The clock channel
mosi - The mosi (output) channel
miso - The miso (input) channel
cs - The chip select channel
range - The range (+ or -) that the accelerometer will measure.

ADXL345_SPI

public ADXL345_SPI(int slot,
                   int clkChannel,
                   int mosiChannel,
                   int misoChannel,
                   int csChannel,
                   ADXL345_SPI.DataFormat_Range range)
Constructor. Use this when the device is the first/only device on the bus

Parameters:
slot - The module of the digital IO for the device
clkChannel - The channel number for the clk channel
mosiChannel - The channel number for the mosi (output) channel
misoChannel - The channel number for the miso (input) channel
csChannel - The channel number for the chip select channel
range - The range (+ or -) that the accelerometer will measure.

ADXL345_SPI

public ADXL345_SPI(DigitalOutput cs,
                   ADXL345_SPI.DataFormat_Range range)
Constructor. Use this constructor only if another SPI device has already been constructed with the clk, mosi and miso pins defined.

Parameters:
cs - the chip select line for the SPI bus
range - The range (+ or -) that the accelerometer will measure.

ADXL345_SPI

public ADXL345_SPI(int slot,
                   int csChannel,
                   ADXL345_SPI.DataFormat_Range range)
Constructor. Use this constructor only if another SPI device has already been constructed with the clk, mosi and miso pins defined.

Parameters:
slot - The module of the digital output for the device's chip select pin
csChannel - The channel for the digital output for the device's chip select pin
range - The range (+ or -) that the accelerometer will measure.
Method Detail

free

public void free()
Description copied from class: SensorBase
Free the resources used by this object

Overrides:
free in class SensorBase

getAcceleration

public double getAcceleration(ADXL345_SPI.Axes axis)
Get the acceleration of one axis in Gs.

Parameters:
axis - The axis to read from.
Returns:
Acceleration of the ADXL345 in Gs.

getAccelerations

public ADXL345_SPI.AllAxes getAccelerations()
Get the acceleration of all axes in Gs.

Returns:
Acceleration measured on all axes of the ADXL345 in Gs.

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"