Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Data Structures | Defines | Functions | Variables

dexterind-nxtchuck.h File Reference

Dexter Industries NXTChuck Sensor driver. More...

#include "common.h"

Go to the source code of this file.

Data Structures

struct  tNunchuck
struct  tClassicCtrl

Defines

#define NXTCHUCK_COM_ERROR   0
#define NXTCHUCK_COM_SUCCESS   1
#define NXTCHUCK_I2C_ADDRESS   0xA4
#define NXTCHUCK_DEVICE_UNKNOWN   1
#define NXTCHUCK_DEVICE_NUNCHUK   2
#define NXTCHUCK_DEVICE_CLASSIC_CONTROLLER   3
#define NXTCHUCK_DEVICE_GH_GUITAR   4
#define NXTCHUCK_DEVICE_GH_DRUMS   5
#define NXTCHUCK_DEVICE_DJH_TURNTABLE   6
#define NXTCHUCK_DEVICE_BALANCE_BOARD   7
#define NXTCHUCK_DEVICE_MOTION_PLUS_ACTIVE   8
#define NXTCHUCK_DEVICE_MOTION_PLUS_ACTIVE_N_PT   9
#define NXTCHUCK_DEVICE_MOTION_PLUS_ACTIVE_CC_PT   10
#define NXTCHUCK_DEVICE_MOTION_PLUS_INACTIVE   11
#define NXTCHUCK_DEVICE_MOTION_PLUS_NL_ACTIVE   12
#define NXTCHUCK_DEVICE_MOTION_PLUS_NL_N_PT   13
#define NXTCHUCK_DEVICE_MOTION_PLUS_NL_CC_PT   14
#define NXTCHUCK_DEVICE_NUNCHUK_BLACK   15
#define NXTCHUCK_N_BTN_Z   0x01
#define NXTCHUCK_N_BTN_C   0x02
#define NXTCHUCK_CC_BTN_RT   0x0002
#define NXTCHUCK_CC_BTN_P   0x0004
#define NXTCHUCK_CC_BTN_H   0x0008
#define NXTCHUCK_CC_BTN_M   0x0010
#define NXTCHUCK_CC_BTN_LT   0x0020
#define NXTCHUCK_CC_BTN_DD   0x0040
#define NXTCHUCK_CC_BTN_DR   0x0080
#define NXTCHUCK_CC_BTN_DU   0x0100
#define NXTCHUCK_CC_BTN_DL   0x0200
#define NXTCHUCK_CC_BTN_ZR   0x0400
#define NXTCHUCK_CC_BTN_X   0x0800
#define NXTCHUCK_CC_BTN_A   0x1000
#define NXTCHUCK_CC_BTN_Y   0x2000
#define NXTCHUCK_CC_BTN_B   0x4000
#define NXTCHUCK_CC_BTN_ZL   0x8000

Functions

bool _NXTChuckInit (tSensors link)
bool __NXTChuckReadRaw (tSensors link, ubyte _reg, tByteArray &data)
bool NXTChuckreadIdent (tSensors link, tNunchuck &nunchuck)
bool NXTChuckreadSensor (tSensors link, tNunchuck &nunchuck)
bool NXTChuckReadClassicController (tSensors link, tClassicCtrl &controller)

Variables

tByteArray NXTCHUCK_I2CRequest
tByteArray NXTCHUCK_I2CReply
bool NXTCHUCKinitialised [] = {false, false, false, false}
ubyte NXTChuckIdentLookup [][]
ubyte _NXTChuckDataInit1 [] = {3, 0xA4, 0xF0, 0x55}
ubyte _NXTChuckDataInit2 [] = {3, 0xA4, 0xFB, 0x00}

Detailed Description

Dexter Industries NXTChuck Sensor driver.

dexterind-nxtchuck.h provides an API for the Dexter Industries NXTChuck Sensor.

Changelog:

Credits:

License: You may use this code as you wish, provided you give credit where its due.

THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.

Author:
Xander Soldaat (xander_at_botbench.com)
Date:
02 November 2012
Version:
0.1

Definition in file dexterind-nxtchuck.h.