This is a example application for StarBoard Orange designed by @logic_star. This example can be drive a CHORO Q HYBRID.
WiiNunchuckDefs.h
00001 /* 00002 * WiiNunchuckReader. A program allowing the output of one or two 00003 * Wii Nunchucks to be read via I2C and decoded for use, using the mbed 00004 * microcontroller and its associated libraries. 00005 * 00006 * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk> 00007 * 00008 * This file is part of WiiNunchuckReader. 00009 * 00010 * WiiNunchuckReader is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * WiiNunchuckReader is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with WiiNunchuckReader. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 #ifndef SNATCH59_WIINUNCHUCKDEFS_H 00025 #define SNATCH59_WIINUNCHUCKDEFS_H 00026 00027 // I2C 00028 #define NUNCHUCK_ADDR 0xA4 // I2C library doesn't right shift the address, so provided shifted 00029 #define NUNCHUCK_REGADDR 0x40 // relevant register address 00030 #define NUNCHUCK_READLEN 0x06 // always read this many bytes back 00031 00032 // received byte position 00033 #define JOY_X 0 00034 #define JOY_Y 1 00035 #define ACCEL_X 2 00036 #define ACCEL_Y 3 00037 #define ACCEL_Z 4 00038 #define ADDITIONAL 5 00039 00040 // bitmasks for addition info byte 00041 #define MASK_CZ 0x03 00042 #define MASK_ACCLX1 0x04 00043 #define MASK_ACCLX2 0x08 00044 #define MASK_ACCLY1 0x10 00045 #define MASK_ACCLY2 0x20 00046 #define MASK_ACCLZ1 0x40 00047 #define MASK_ACCLZ2 0x80 00048 00049 // timing 00050 #define I2C_READ_DELAY 0.01 00051 00052 // I2C status 00053 #define I2C_OK 0 // zero on success (ACK), non-zero on fail (NACK) for read or write 00054 00055 #endif
Generated on Tue Jul 12 2022 22:53:27 by 1.7.2