libnds
Functions
ndsmotion.h File Reference

interface code for the ds motion card, ds motion pak, MK6. 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)
 
void motion_deinit (void)
 Deinitializes the DS Motion Sensor.
 
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.
 
int 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 motion_ functions. More...
 
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.
 
signed int motion_read_gyro (void)
 read the Z rotational speed More...
 
signed int motion_read_x (void)
 read the X acceleration More...
 
signed int motion_read_y (void)
 read the Y acceleration More...
 
signed int motion_read_z (void)
 read the Z acceleration More...
 
int motion_rotation (void)
 converts raw rotation value to degrees per second
 
void motion_set_calibration (MotionCalibration *cal)
 This sets the calibration settings. Intended to restore saved calibration settings. More...
 
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 More...
 
void motion_set_sens_x (int sens)
 this should be passed the raw reading at 1g for accurate acceleration calculations. Default is 819 More...
 
void motion_set_sens_y (int sens)
 this should be passed the raw reading at 1g for accurate acceleration calculations. Default is 819 More...
 
void motion_set_sens_z (int sens)
 this should be passed the raw reading at 1g for accurate acceleration calculations. Default is 819 More...
 

Detailed Description

interface code for the ds motion card, ds motion pak, MK6.

Function Documentation

int 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 motion_ functions.

Returns
signed int motion_read_gyro ( void  )

read the Z rotational speed

Returns
signed int motion_read_x ( void  )

read the X acceleration

Returns
signed int motion_read_y ( void  )

read the Y acceleration

Returns
signed int motion_read_z ( void  )

read the Z acceleration

Returns
void motion_set_calibration ( MotionCalibration *  cal)

This sets the calibration settings. Intended to restore saved calibration settings.

Parameters
calthe calibration settings
void motion_set_sens_gyro ( int  sens)

this should be passed the raw reading at 1g for accurate acceleration calculations. Default is 825

Parameters
sensthe 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

Parameters
sensthe 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

Parameters
sensthe 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

Parameters
sensthe raw reading at 1g for accurate acceleration calculations