libnds
|
DS Motion Card/DS Motion Pak functionality. More...
#include <stdbool.h>
Data Structures | |
struct | MotionCalibration |
Struct that contains data read from a motion sensor. More... | |
Typedefs | |
typedef struct MotionCalibration | MotionCalibration |
Struct that contains data read from a motion sensor. | |
Enumerations | |
enum | MotionType { MOTION_TYPE_NONE , MOTION_TYPE_PAK , MOTION_TYPE_PAK_ATTINY , MOTION_TYPE_CARD , MOTION_TYPE_MK6 } |
List of types of motion sensors supported. More... | |
Functions | |
int | motion_acceleration_x (void) |
Gets acceleration value to mili G (where g is 9.8 m/s*s) | |
int | motion_acceleration_y (void) |
Gets acceleration value to mili G (where g is 9.8 m/s*s) | |
int | motion_acceleration_z (void) |
Gets acceleration value to mili G (where g is 9.8 m/s*s) | |
bool | motion_accelerometer_supported (void) |
Check if the accelerometer is supported on this device. | |
bool | motion_ain_supported (void) |
Check if the analog input is supported on this device. | |
void | motion_deinit (void) |
Deinitializes the DS Motion Sensor. | |
void | motion_enable_ain_1 (void) |
This enables the analog input number 1. | |
void | motion_enable_ain_2 (void) |
This enables the analog input number 2. | |
MotionCalibration * | motion_get_calibration (void) |
This returns the current calibration settings for saving. | |
const char * | motion_get_name (MotionType type) |
Get the name of a given motion sensor type, or "None". | |
MotionType | motion_get_type (void) |
Get the type of the current initialized DS Motion Sensor. | |
bool | motion_gyroscope_supported (void) |
Check if the gyroscope is likely supported on this device. | |
MotionType | motion_init (void) |
Initializes the DS Motion Sensor. | |
int | motion_read_ain_1 (void) |
This reads the analog input number 1. | |
int | motion_read_ain_2 (void) |
This reads the analog input number 2. | |
int | motion_read_gyro (void) |
Reads the Z rotational speed. | |
int | motion_read_x (void) |
Reads the X acceleration. | |
int | motion_read_y (void) |
Reads the Y acceleration. | |
int | motion_read_z (void) |
Reads the Z acceleration. | |
int | motion_rotation (void) |
Converts raw rotation to degrees per second. | |
void | motion_set_calibration (MotionCalibration *cal) |
This sets the calibration settings. | |
void | motion_set_offs_gyro (void) |
This should be called when the axis is under no rotation. | |
void | motion_set_offs_x (void) |
This should be called when the axis is under no acceleration. | |
void | motion_set_offs_y (void) |
This should be called when the axis is under no acceleration. | |
void | motion_set_offs_z (void) |
This should be called when the axis is under no acceleration. | |
void | motion_set_sens_gyro (int sens) |
This should be passed the raw reading at 1g for accurate acceleration calculations. | |
void | motion_set_sens_x (int sens) |
This should be passed the raw reading at 1g for accurate acceleration calculations. | |
void | motion_set_sens_y (int sens) |
This should be passed the raw reading at 1g for accurate acceleration calculations. | |
void | motion_set_sens_z (int sens) |
This should be passed the raw reading at 1g for accurate acceleration calculations. | |
DS Motion Card/DS Motion Pak functionality.
Interface code for the ds motion card, ds motion pak, MK6.
enum MotionType |
int motion_acceleration_x | ( | void | ) |
Gets acceleration value to mili G (where g is 9.8 m/s*s)
int motion_acceleration_y | ( | void | ) |
Gets acceleration value to mili G (where g is 9.8 m/s*s)
int motion_acceleration_z | ( | void | ) |
Gets acceleration value to mili G (where g is 9.8 m/s*s)
bool motion_accelerometer_supported | ( | void | ) |
Check if the accelerometer is supported on this device.
bool motion_ain_supported | ( | void | ) |
Check if the analog input is supported on this device.
void motion_enable_ain_1 | ( | void | ) |
This enables the analog input number 1.
Required before reading analog input number 1.
void motion_enable_ain_2 | ( | void | ) |
This enables the analog input number 2.
Required before reading analog input number 2.
MotionCalibration * motion_get_calibration | ( | void | ) |
This returns the current calibration settings for saving.
const char * motion_get_name | ( | MotionType | type | ) |
Get the name of a given motion sensor type, or "None".
type | The type of the motion sensor. |
MotionType motion_get_type | ( | void | ) |
Get the type of the current initialized DS Motion Sensor.
bool motion_gyroscope_supported | ( | void | ) |
Check if the gyroscope is likely supported on this device.
Note that some cartridges may come with the gyroscope not populated; this only allows ruling out devices which are guaranteed not to have a gyroscope.
MotionType motion_init | ( | void | ) |
Initializes the DS Motion Sensor.
Run this before using any of the DS Motion Sensor functions. Save the return value and pass it to the other functions.
int motion_read_ain_1 | ( | void | ) |
This reads the analog input number 1.
Analog input number 1 needs to be enabled before reading.
int motion_read_ain_2 | ( | void | ) |
This reads the analog input number 2.
Analog input number 2 needs to be enabled before reading.
int motion_read_gyro | ( | void | ) |
Reads the Z rotational speed.
int motion_read_x | ( | void | ) |
Reads the X acceleration.
int motion_read_y | ( | void | ) |
Reads the Y acceleration.
int motion_read_z | ( | void | ) |
Reads the Z acceleration.
int motion_rotation | ( | void | ) |
Converts raw rotation to degrees per second.
void motion_set_calibration | ( | MotionCalibration * | cal | ) |
This sets the calibration settings.
Intended to restore previously saved calibration settings
cal | The calibration settings |
void motion_set_offs_gyro | ( | void | ) |
This should be called when the axis is under no rotation.
Default is 1680.
void motion_set_offs_x | ( | void | ) |
This should be called when the axis is under no acceleration.
Default is 2048.
void motion_set_offs_y | ( | void | ) |
This should be called when the axis is under no acceleration.
Default is 2048.
void motion_set_offs_z | ( | void | ) |
This should be called when the axis is under no acceleration.
Default is 2048.
void motion_set_sens_gyro | ( | int | sens | ) |
This should be passed the raw reading at 1g for accurate acceleration calculations.
Default is 825
sens | The raw reading at 1g for accurate acceleration calculations. |
void motion_set_sens_x | ( | int | sens | ) |
This should be passed the raw reading at 1g for accurate acceleration calculations.
Default is 819
sens | The raw reading at 1g for accurate acceleration calculations. |
void motion_set_sens_y | ( | int | sens | ) |
This should be passed the raw reading at 1g for accurate acceleration calculations.
Default is 819
sens | The raw reading at 1g for accurate acceleration calculations. |
void motion_set_sens_z | ( | int | sens | ) |
This should be passed the raw reading at 1g for accurate acceleration calculations.
Default is 819
sens | The raw reading at 1g for accurate acceleration calculations. |