Monado OpenXR Runtime
wmr_controller_hp.c File Reference

Driver for WMR Controllers. More...

#include "math/m_api.h"
#include "util/u_device.h"
#include "util/u_trace_marker.h"
#include "util/u_var.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include "wmr_controller.h"
Include dependency graph for wmr_controller_hp.c:

Data Structures

struct  wmr_controller_hp_input
 
struct  wmr_controller_hp
 

Macros

#define WMR_TRACE(ctrl, ...)   U_LOG_XDEV_IFL_T(&ctrl->base.base, ctrl->base.log_level, __VA_ARGS__)
 
#define WMR_TRACE_HEX(ctrl, ...)   U_LOG_XDEV_IFL_T_HEX(&ctrl->base.base, ctrl->base.log_level, __VA_ARGS__)
 
#define WMR_DEBUG(ctrl, ...)   U_LOG_XDEV_IFL_D(&ctrl->base.base, ctrl->base.log_level, __VA_ARGS__)
 
#define WMR_DEBUG_HEX(ctrl, ...)   U_LOG_XDEV_IFL_D_HEX(&ctrl->base.base, ctrl->base.log_level, __VA_ARGS__)
 
#define WMR_INFO(ctrl, ...)   U_LOG_XDEV_IFL_I(&ctrl->base.base, ctrl->base.log_level, __VA_ARGS__)
 
#define WMR_WARN(ctrl, ...)   U_LOG_XDEV_IFL_W(&ctrl->base.base, ctrl->base.log_level, __VA_ARGS__)
 
#define WMR_ERROR(ctrl, ...)   U_LOG_XDEV_IFL_E(&ctrl->base.base, ctrl->base.log_level, __VA_ARGS__)
 
#define WMR_PACKED
 
#define SET_INPUT(wcb, INDEX, NAME)    (wcb->base.inputs[WMR_CONTROLLER_INDEX_##INDEX].name = XRT_INPUT_G2_CONTROLLER_##NAME)
 

Enumerations

enum  wmr_controller_hp_input_index {
  WMR_CONTROLLER_INDEX_MENU_CLICK , WMR_CONTROLLER_INDEX_HOME_CLICK , WMR_CONTROLLER_INDEX_SQUEEZE_CLICK , WMR_CONTROLLER_INDEX_SQUEEZE_VALUE ,
  WMR_CONTROLLER_INDEX_TRIGGER_VALUE , WMR_CONTROLLER_INDEX_THUMBSTICK_CLICK , WMR_CONTROLLER_INDEX_THUMBSTICK , WMR_CONTROLLER_INDEX_GRIP_POSE ,
  WMR_CONTROLLER_INDEX_AIM_POSE , WMR_CONTROLLER_INDEX_X_A_CLICK , WMR_CONTROLLER_INDEX_Y_B_CLICK , WMR_CONTROLLER_INDEX_COUNT
}
 Indices in input list of each input. More...
 

Functions

static void vec3_from_wmr_controller_accel (const int32_t sample[3], struct xrt_vec3 *out_vec)
 
static void vec3_from_wmr_controller_gyro (const int32_t sample[3], struct xrt_vec3 *out_vec)
 
static bool wmr_controller_hp_packet_parse (struct wmr_controller_hp *ctrl, const unsigned char *buffer, size_t len)
 
static bool handle_input_packet (struct wmr_controller_base *wcb, uint64_t time_ns, uint8_t *buffer, uint32_t buf_size)
 
static xrt_result_t wmr_controller_hp_update_inputs (struct xrt_device *xdev)
 
static void wmr_controller_hp_set_output (struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value)
 
static void wmr_controller_hp_destroy (struct xrt_device *xdev)
 
struct wmr_controller_basewmr_controller_hp_create (struct wmr_controller_connection *conn, enum xrt_device_type controller_type, enum u_logging_level log_level)
 

Variables

static struct xrt_binding_input_pair simple_inputs [4]
 
static struct xrt_binding_output_pair simple_outputs [1]
 
static struct xrt_binding_profile binding_profiles [1]
 

Detailed Description

Driver for WMR Controllers.

Author
Jan Schmidt jan@c.nosp@m.entr.nosp@m.icula.nosp@m.r.co.nosp@m.m

Enumeration Type Documentation

◆ wmr_controller_hp_input_index

Indices in input list of each input.

Variable Documentation

◆ binding_profiles

struct xrt_binding_profile binding_profiles[1]
static
Initial value:
= {
{
.name = XRT_DEVICE_SIMPLE_CONTROLLER,
.inputs = simple_inputs,
.input_count = ARRAY_SIZE(simple_inputs),
.outputs = simple_outputs,
.output_count = ARRAY_SIZE(simple_outputs),
},
}
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:30

◆ simple_inputs

struct xrt_binding_input_pair simple_inputs[4]
static
Initial value:
= {
{XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_G2_CONTROLLER_TRIGGER_VALUE},
{XRT_INPUT_SIMPLE_MENU_CLICK, XRT_INPUT_G2_CONTROLLER_MENU_CLICK},
{XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_G2_CONTROLLER_GRIP_POSE},
{XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_G2_CONTROLLER_AIM_POSE},
}

◆ simple_outputs

struct xrt_binding_output_pair simple_outputs[1]
static
Initial value:
= {
{XRT_OUTPUT_NAME_SIMPLE_VIBRATION, XRT_OUTPUT_NAME_G2_CONTROLLER_HAPTIC},
}