nn::hid::CTR::AccelerometerReader Class

Syntax

class AccelerometerReader : private ADLFireWall::NonCopyable

Description

Class for loading sampling data from the accelerometer.

Sampling Rate

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.

Output Value Processing Features

This class includes the following features to process output values.

Acceleration Variation ToleranceYou can apply a correction to control any major variation in acceleration during continuous sampling.
Offset CorrectionOutputs after subtracting the specified value from sampling results.
Axial RotationOutputs sampling results multiplied by an optional rotation matrix. Allows for the output of values as if the accelerometer were on an incline.

All processing features are disabled by default. Configure and enable them as needed. For details, see the various function references.

Axis Orientation

The default accelerometer sensors are as follows.

X+The direction indicated by left on the +Control Pad
Y+The direction indicated by the touch screen face
Z+The direction indicated by up on the +Control Pad

Member Functions

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).

Class Hierarchy

ADLFireWall::NonCopyable
  nn::hid::CTR::AccelerometerReader

Revision History

2010/01/07
Initial version.

CONFIDENTIAL