RetroArch
Functions
dynamics.c File Reference

Handles the dynamics of the wiimote. More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "definitions.h"
#include "wiiuse_internal.h"
#include "ir.h"
#include "dynamics.h"
Include dependency graph for dynamics.c:

Functions

void calculate_orientation (struct accel_t *ac, struct vec3w_t *accel, struct orient_t *orient, int smooth)
 Calculate the roll, pitch, yaw. More...
 
void calculate_gforce (struct accel_t *ac, struct vec3w_t *accel, struct gforce_t *gforce)
 Calculate the gravity forces on each axis. More...
 
static float applyCalibration (float inval, float minval, float maxval, float centerval)
 
void calc_joystick_state (struct joystick_t *js, float x, float y)
 Calculate the angle and magnitude of a joystick. More...
 
void apply_smoothing (struct accel_t *ac, struct orient_t *orient, int type)
 

Detailed Description

Handles the dynamics of the wiimote.

The file includes functions that handle the dynamics of the wiimote. Such dynamics include orientation and motion sensing.

Function Documentation

◆ apply_smoothing()

void apply_smoothing ( struct accel_t ac,
struct orient_t orient,
int  type 
)
Here is the caller graph for this function:

◆ applyCalibration()

static float applyCalibration ( float  inval,
float  minval,
float  maxval,
float  centerval 
)
static

◆ calc_joystick_state()

void calc_joystick_state ( struct joystick_t js,
float  x,
float  y 
)

Calculate the angle and magnitude of a joystick.

Parameters
js[out] Pointer to a joystick_t structure.
xThe raw x-axis value.
yThe raw y-axis value.
Here is the caller graph for this function:

◆ calculate_gforce()

void calculate_gforce ( struct accel_t ac,
struct vec3w_t accel,
struct gforce_t gforce 
)

Calculate the gravity forces on each axis.

Parameters
acAn accelerometer (accel_t) structure.
accel[in] Pointer to a vec3w_t structure that holds the raw acceleration data.
gforce[out] Pointer to a gforce_t structure that will hold the gravity force data.
Here is the caller graph for this function:

◆ calculate_orientation()

void calculate_orientation ( struct accel_t ac,
struct vec3w_t accel,
struct orient_t orient,
int  smooth 
)

Calculate the roll, pitch, yaw.

Parameters
acAn accelerometer (accel_t) structure.
accel[in] Pointer to a vec3w_t structure that holds the raw acceleration data.
orient[out] Pointer to a orient_t structure that will hold the orientation data.
rorient[out] Pointer to a orient_t structure that will hold the non-smoothed orientation data.
smoothIf smoothing should be performed on the angles calculated. 1 to enable, 0 to disable.

Given the raw acceleration data from the accelerometer struct, calculate the orientation of the device and set it in the orient parameter.

Here is the call graph for this function:
Here is the caller graph for this function: