001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.hal;
006
007/**
008 * Accelerometer HAL JNI methods.
009 *
010 * @see "hal/Accelerometer.h"
011 */
012public class AccelerometerJNI extends JNIWrapper {
013  /**
014   * Sets the accelerometer to active or standby mode.
015   *
016   * <p>It must be in standby mode to change any configuration.
017   *
018   * @see "HAL_SetAccelerometerActive"
019   * @param active true to set to active, false for standby
020   */
021  public static native void setAccelerometerActive(boolean active);
022
023  /**
024   * Sets the range of values that can be measured (either 2, 4, or 8 g-forces).
025   *
026   * <p>The accelerometer should be in standby mode when this is called.
027   *
028   * @see "HAL_SetAccelerometerRange(int range)"
029   * @param range the accelerometer range
030   */
031  public static native void setAccelerometerRange(int range);
032
033  /**
034   * Gets the x-axis acceleration.
035   *
036   * <p>This is a floating point value in units of 1 g-force.
037   *
038   * @see "HAL_GetAccelerometerX()"
039   * @return the X acceleration
040   */
041  public static native double getAccelerometerX();
042
043  /**
044   * Gets the y-axis acceleration.
045   *
046   * <p>This is a floating point value in units of 1 g-force.
047   *
048   * @see "HAL_GetAccelerometerY()"
049   * @return the Y acceleration
050   */
051  public static native double getAccelerometerY();
052
053  /**
054   * Gets the z-axis acceleration.
055   *
056   * <p>This is a floating point value in units of 1 g-force.
057   *
058   * @see "HAL_GetAccelerometerZ()"
059   * @return the Z acceleration
060   */
061  public static native double getAccelerometerZ();
062}