Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Writing a Sensor Driver for the Wiimote on Windows 7

, 16 Feb 2010
How to write a Sensor driver that provides access to the 3-axis accelerometer on a Nintendo Wiimote on Windows 7
amd64.zip
amd64
WiimoteSensor.dll
WiimoteSensor.inf
WiimoteSensor.pdb
WUDFUpdate_01009.dll
i386.zip
i386
WiimoteSensor.dll
WiimoteSensor.inf
WiimoteSensor.pdb
WUDFUpdate_01009.dll
src.zip
src
Driver
buildfre_win7_amd64.wrn
buildfre_win7_x86.wrn
install
makefile
mbld
sources
WiimoteSensor.aps
WiimoteSensor.ctl
WiimoteSensor.def
WiimoteSensor.inx
Wiidiag
bin
lib
Microsoft.WindowsAPICodePack.dll
Microsoft.WindowsAPICodePack.pdb
Microsoft.WindowsAPICodePack.Sensors.dll
Microsoft.WindowsAPICodePack.Sensors.pdb
Properties
Settings.settings
WiiSensor.suo
tools.zip
tools
devcon
amd64
devcon.exe
i386
devcon.exe
PlaneDemo
DemoApp.exe
DemoApp.pdb
Microsoft.WindowsAPICodePack.dll
Microsoft.WindowsAPICodePack.pdb
Microsoft.WindowsAPICodePack.Sensors.dll
Microsoft.WindowsAPICodePack.Sensors.pdb
WiimoteTest
WiimoteLib.dll
WiimoteTest.exe
Wiidiag.zip
Wiidiag
Microsoft.WindowsAPICodePack.dll
Microsoft.WindowsAPICodePack.Sensors.dll
Wiidiag.exe
/*++

Module Name:

    Internal.h

Abstract:

    This module contains the local type definitions for the Wii Sensor driver.

--*/

#pragma once

#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlstr.h>
#include <stdarg.h >

// STL headers
#include <vector>
#include <list>
#include <map>
#include <string>
#include <memory>

using namespace std;

__user_driver;  // Macro letting the compiler know this is not a kernel driver (this will help surpress needless warnings)

// Common WPD and WUDF headers
#include <devioctl.h>
#include <hidclass.h>
#include <initguid.h>
#include <propkeydef.h>
#include <propvarutil.h>
#include "PortableDeviceTypes.h"
#include "PortableDeviceClassExtension.h"
#include "PortableDevice.h"

// Headers for Sensor specific defines and WpdCommands
#include "Sensors.h"
#include <SensorsClassExtension.h>

// One forward-declare that pretty much everyone is going to need to know about
class CWiimoteDevice;

///////////////////////////////////////////////////////////////////
// Common macro expansions that are used throughout the project
#define SAFE_RELEASE(p)     {if ((p)) { (p)->Release(); (p) = NULL; }}
#define ARRAY_SIZE(x)       (sizeof(x) / sizeof(x[0]))


///////////////////////////////////////////////////////////////////
// TRACING SUPPORT
//
// Define the tracing flags.
// Choose a different trace control GUID
//
// Tracing Information
#define MYDRIVER_TRACING_ID L"Nerdworks\\Sensor\\WiimoteSensorDriver"

//
// Define the tracing flags.
//
// Choose a different trace control GUID
//

#define WPP_CONTROL_GUIDS   WPP_DEFINE_CONTROL_GUID( WiimoteSensorDriverTraceControl, (D266DF26,6D5E,4f22,8B78,187EC054598C), \
                                                      WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) )

#define WPP_FLAG_LEVEL_LOGGER(flag, level)      WPP_LEVEL_LOGGER(flag)

#define WPP_FLAG_LEVEL_ENABLED(flag, level)    ( WPP_LEVEL_ENABLED(flag) && \
                                                 WPP_CONTROL(WPP_BIT_ ## flag).Level >= level )

//
// This comment block is scanned by the trace preprocessor to define our
// Trace function.
//
// begin_wpp config
// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
// end_wpp
//


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Rajasekharan Vengalil
Microsoft
India India
No Biography provided
Follow on   Twitter   Google+

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 16 Feb 2010
Article Copyright 2010 by Rajasekharan Vengalil
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid