We've just wrapped up a whitepaper that describes the creation of a sample driver that supports four sensors: compass, 2-axis accelerometer, ultrasonic distance, and passive-infrared (or motion).

You can download the whitepaper and accompanying source files at http://code.msdn.microsoft.com/motionsensor

 (In addition to the driver source files, you'll find source files for the sensor firmware as well as source files for a simple .Net application that you can use to test your driver and sensors.)