nn::hid::CTR::AccelerometerReader Classclass AccelerometerReader : private ADLFireWall::NonCopyable
Class for loading sampling data from the accelerometer.
The accelerometer is sampled an average of every 10 milliseconds. Use the nn::hid::CTR::Accelerometer class to know when sampling occurs, allowing you to accurately monitor sampling timing.
No sampling is done right after generating a class instance or right after recovering from sleep, so calls to the nn::hid::CTR::AccelerometerReader::Read or nn::hid::CTR::AccelerometerReader::ReadLatest functions might not have any effect. To avoid this, Nintendo recommends calling the nn::hid::CTR::Accelerometer::WaitSampling function right after generating a class instance or when recovering from sleep to wait until results have been sampled at least once. This wait time is the same as the sampling frequency, up to a maximum of approximately 10 milliseconds.
Accelerometer sampling halts in two cases: when the system is in Sleep Mode, and when there are no instances of the AccelerometerReader class. You must destroy all instances to explicitly stop sampling.
This class includes the following features to process output values.
| Acceleration Variation Tolerance | You can apply a correction to control any major variation in acceleration during continuous sampling. |
|---|---|
| Offset Correction | Outputs after subtracting the specified value from sampling results. |
| Axial Rotation | Outputs sampling results multiplied by an optional rotation matrix. Allows for the output of values as if the accelerometer were on an incline. |
The default accelerometer sensors are as follows.
| X+ | The direction indicated by Left on the +Control Pad |
|---|---|
| Y+ | The direction normal to and outward from the Touch Screen |
| Z+ | The direction indicated by Up on the +Control Pad |
| Constructors/Destructors | ||
|---|---|---|
| AccelerometerReader | Constructor. | |
~AccelerometerReader
|
Destructor. | |
| Reading Sampling Data | ||
Read
|
Loads sampling data from the accelerometer starting with the newest samples. Does not load any data that has been previously loaded. | |
ReadLatest
|
Loads the newest sampling data from the accelerometer. Unlike the nn::hid::CTR::AccelerometerReader::Read function, this function can load the same sampling data more than once. |
|
| Control Functions for Acceleration Variation Tolerance | ||
GetSensitivity
|
Gets the settings for sensitivity and play tolerance for the change in acceleration between samples. | |
SetSensitivity
|
Sets the sensitivity and play tolerance for the change in acceleration between samples. | |
| Axial Rotation | ||
EnableAxisRotation
|
Enables axial rotation of the accelerometer. | |
DisableAxisRotation
|
Disables axial rotation of the accelerometer. | |
IsEnableAxisRotation
|
Checks whether axial rotation is enabled or disabled for the accelerometer. | |
SetAxisRotationMatrix
|
Specifies the rotation matrix used for axial rotation of the accelerometer's sampling data. | |
GetAxisRotationMatrix
|
Gets the rotation matrix currently specified to use for axial rotation of the accelerometer's sampling data. | |
ResetAxisRotationMatrix
|
Initializes the rotation matrix to use for transforming the accelerometer's sampling data. | |
| Offset. | ||
EnableOffset
|
Enables the accelerometer offset. | |
DisableOffset
|
Disables the accelerometer offset. | |
IsEnableOffset
|
Checks whether the accelerometer offset is enabled or disabled. | |
SetOffset
|
Sets the accelerometer offset value. | |
SetOffsetFromBaseStatus
|
Sets the accelerometer offset value. | |
GetOffset
|
Gets the accelerometer offset value. | |
ResetOffset
|
Resets the accelerometer offset value to the default. | |
| Other | ||
| ConvertToAcceleration | Converts the raw sampling data from the accelerometer into acceleration values (in g's). | |
ADLFireWall::NonCopyable
nn::hid::CTR::AccelerometerReader
CONFIDENTIAL