WPILibC++ 2024.3.2
Accelerometer.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include "hal/Types.h"
8
9/**
10 * @defgroup hal_accelerometer Accelerometer Functions
11 * @ingroup hal_capi
12 * @{
13 */
14
15/**
16 * The acceptable accelerometer ranges.
17 */
22};
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27/**
28 * Sets the accelerometer to active or standby mode.
29 *
30 * It must be in standby mode to change any configuration.
31 *
32 * @param active true to set to active, false for standby
33 */
35
36/**
37 * Sets the range of values that can be measured (either 2, 4, or 8 g-forces).
38 *
39 * The accelerometer should be in standby mode when this is called.
40 *
41 * @param range the accelerometer range
42 */
44
45/**
46 * Gets the x-axis acceleration.
47 *
48 * This is a floating point value in units of 1 g-force.
49 *
50 * @return the X acceleration
51 */
53
54/**
55 * Gets the y-axis acceleration.
56 *
57 * This is a floating point value in units of 1 g-force.
58 *
59 * @return the Y acceleration
60 */
62
63/**
64 * Gets the z-axis acceleration.
65 *
66 * This is a floating point value in units of 1 g-force.
67 *
68 * @return the Z acceleration
69 */
71#ifdef __cplusplus
72} // extern "C"
73/** @} */
74#endif
@ HAL_ENUM
Definition: Value.h:14
HAL_AccelerometerRange
The acceptable accelerometer ranges.
Definition: Accelerometer.h:18
double HAL_GetAccelerometerZ(void)
Gets the z-axis acceleration.
void HAL_SetAccelerometerRange(HAL_AccelerometerRange range)
Sets the range of values that can be measured (either 2, 4, or 8 g-forces).
void HAL_SetAccelerometerActive(HAL_Bool active)
Sets the accelerometer to active or standby mode.
double HAL_GetAccelerometerX(void)
Gets the x-axis acceleration.
double HAL_GetAccelerometerY(void)
Gets the y-axis acceleration.
@ HAL_AccelerometerRange_k8G
Definition: Accelerometer.h:21
@ HAL_AccelerometerRange_k4G
Definition: Accelerometer.h:20
@ HAL_AccelerometerRange_k2G
Definition: Accelerometer.h:19
int32_t HAL_Bool
Definition: Types.h:73