Jubeat (ユビート Yubīto?), stylized as jubeat, is a series of arcade music video games developed by Konami Computer Entertainment Japan, and is a part of Konami's Bemani line of music video games. The series uses an arrangement of 16 buttons in a 4x4 grid for gameplay, a grid also used for the displaying of cues and part of the user interface.

Dependencies:   4DGL-uLCD-SE SDFileSystem TextLCD mbed-rtos mbed wave_player

Fork of ECE4180_Lab4 by Zhihan Jiang

Committer:
ToHellWithGeorgi
Date:
Wed Mar 16 13:38:50 2016 +0000
Revision:
0:c3c8793d0091
ECE 4180 jubeat;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ToHellWithGeorgi 0:c3c8793d0091 1 /*
ToHellWithGeorgi 0:c3c8793d0091 2 Copyright (c) 2011 Anthony Buckton (abuckton [at] blackink [dot} net {dot} au)
ToHellWithGeorgi 0:c3c8793d0091 3
ToHellWithGeorgi 0:c3c8793d0091 4
ToHellWithGeorgi 0:c3c8793d0091 5 Permission is hereby granted, free of charge, to any person obtaining a copy
ToHellWithGeorgi 0:c3c8793d0091 6 of this software and associated documentation files (the "Software"), to deal
ToHellWithGeorgi 0:c3c8793d0091 7 in the Software without restriction, including without limitation the rights
ToHellWithGeorgi 0:c3c8793d0091 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
ToHellWithGeorgi 0:c3c8793d0091 9 copies of the Software, and to permit persons to whom the Software is
ToHellWithGeorgi 0:c3c8793d0091 10 furnished to do so, subject to the following conditions:
ToHellWithGeorgi 0:c3c8793d0091 11
ToHellWithGeorgi 0:c3c8793d0091 12 The above copyright notice and this permission notice shall be included in
ToHellWithGeorgi 0:c3c8793d0091 13 all copies or substantial portions of the Software.
ToHellWithGeorgi 0:c3c8793d0091 14
ToHellWithGeorgi 0:c3c8793d0091 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
ToHellWithGeorgi 0:c3c8793d0091 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
ToHellWithGeorgi 0:c3c8793d0091 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
ToHellWithGeorgi 0:c3c8793d0091 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
ToHellWithGeorgi 0:c3c8793d0091 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ToHellWithGeorgi 0:c3c8793d0091 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
ToHellWithGeorgi 0:c3c8793d0091 21 THE SOFTWARE.
ToHellWithGeorgi 0:c3c8793d0091 22
ToHellWithGeorgi 0:c3c8793d0091 23 Parts written by Jim Lindblom of Sparkfun
ToHellWithGeorgi 0:c3c8793d0091 24 Ported to mbed by A.Buckton, Feb 2011
ToHellWithGeorgi 0:c3c8793d0091 25 */
ToHellWithGeorgi 0:c3c8793d0091 26
ToHellWithGeorgi 0:c3c8793d0091 27 #ifndef MPR121_H
ToHellWithGeorgi 0:c3c8793d0091 28 #define MPR121_H
ToHellWithGeorgi 0:c3c8793d0091 29
ToHellWithGeorgi 0:c3c8793d0091 30 //using namespace std;
ToHellWithGeorgi 0:c3c8793d0091 31
ToHellWithGeorgi 0:c3c8793d0091 32 class Mpr121
ToHellWithGeorgi 0:c3c8793d0091 33 {
ToHellWithGeorgi 0:c3c8793d0091 34
ToHellWithGeorgi 0:c3c8793d0091 35 public:
ToHellWithGeorgi 0:c3c8793d0091 36 // i2c Addresses, bit-shifted
ToHellWithGeorgi 0:c3c8793d0091 37 enum Address { ADD_VSS = 0xb4,// ADD->VSS = 0x5a <-wiring on Sparkfun board
ToHellWithGeorgi 0:c3c8793d0091 38 ADD_VDD = 0xb6,// ADD->VDD = 0x5b
ToHellWithGeorgi 0:c3c8793d0091 39 ADD_SCL = 0xb8,// ADD->SDA = 0x5c
ToHellWithGeorgi 0:c3c8793d0091 40 ADD_SDA = 0xba // ADD->SCL = 0x5d
ToHellWithGeorgi 0:c3c8793d0091 41 };
ToHellWithGeorgi 0:c3c8793d0091 42
ToHellWithGeorgi 0:c3c8793d0091 43 // Real initialiser, takes the i2c address of the device.
ToHellWithGeorgi 0:c3c8793d0091 44 Mpr121(I2C *i2c, Address i2cAddress);
ToHellWithGeorgi 0:c3c8793d0091 45
ToHellWithGeorgi 0:c3c8793d0091 46 bool getProximityMode();
ToHellWithGeorgi 0:c3c8793d0091 47
ToHellWithGeorgi 0:c3c8793d0091 48 void setProximityMode(bool mode);
ToHellWithGeorgi 0:c3c8793d0091 49
ToHellWithGeorgi 0:c3c8793d0091 50 int readTouchData();
ToHellWithGeorgi 0:c3c8793d0091 51
ToHellWithGeorgi 0:c3c8793d0091 52 unsigned char read(int key);
ToHellWithGeorgi 0:c3c8793d0091 53
ToHellWithGeorgi 0:c3c8793d0091 54 int write(int address, unsigned char value);
ToHellWithGeorgi 0:c3c8793d0091 55 int writeMany(int start, unsigned char* dataSet, int length);
ToHellWithGeorgi 0:c3c8793d0091 56
ToHellWithGeorgi 0:c3c8793d0091 57 void setElectrodeThreshold(int electrodeId, unsigned char touchThreshold, unsigned char releaseThreshold);
ToHellWithGeorgi 0:c3c8793d0091 58
ToHellWithGeorgi 0:c3c8793d0091 59 protected:
ToHellWithGeorgi 0:c3c8793d0091 60 // Configures the MPR with standard settings. This is permitted to be overwritten by sub-classes.
ToHellWithGeorgi 0:c3c8793d0091 61 void configureSettings();
ToHellWithGeorgi 0:c3c8793d0091 62
ToHellWithGeorgi 0:c3c8793d0091 63 private:
ToHellWithGeorgi 0:c3c8793d0091 64 // The I2C bus instance.
ToHellWithGeorgi 0:c3c8793d0091 65 I2C *i2c;
ToHellWithGeorgi 0:c3c8793d0091 66
ToHellWithGeorgi 0:c3c8793d0091 67 // i2c address of this mpr121
ToHellWithGeorgi 0:c3c8793d0091 68 Address address;
ToHellWithGeorgi 0:c3c8793d0091 69 };
ToHellWithGeorgi 0:c3c8793d0091 70
ToHellWithGeorgi 0:c3c8793d0091 71
ToHellWithGeorgi 0:c3c8793d0091 72 // MPR121 Register Defines
ToHellWithGeorgi 0:c3c8793d0091 73 #define MHD_R 0x2B
ToHellWithGeorgi 0:c3c8793d0091 74 #define NHD_R 0x2C
ToHellWithGeorgi 0:c3c8793d0091 75 #define NCL_R 0x2D
ToHellWithGeorgi 0:c3c8793d0091 76 #define FDL_R 0x2E
ToHellWithGeorgi 0:c3c8793d0091 77 #define MHD_F 0x2F
ToHellWithGeorgi 0:c3c8793d0091 78 #define NHD_F 0x30
ToHellWithGeorgi 0:c3c8793d0091 79 #define NCL_F 0x31
ToHellWithGeorgi 0:c3c8793d0091 80 #define FDL_F 0x32
ToHellWithGeorgi 0:c3c8793d0091 81 #define NHDT 0x33
ToHellWithGeorgi 0:c3c8793d0091 82 #define NCLT 0x34
ToHellWithGeorgi 0:c3c8793d0091 83 #define FDLT 0x35
ToHellWithGeorgi 0:c3c8793d0091 84 // Proximity sensing controls
ToHellWithGeorgi 0:c3c8793d0091 85 #define MHDPROXR 0x36
ToHellWithGeorgi 0:c3c8793d0091 86 #define NHDPROXR 0x37
ToHellWithGeorgi 0:c3c8793d0091 87 #define NCLPROXR 0x38
ToHellWithGeorgi 0:c3c8793d0091 88 #define FDLPROXR 0x39
ToHellWithGeorgi 0:c3c8793d0091 89 #define MHDPROXF 0x3A
ToHellWithGeorgi 0:c3c8793d0091 90 #define NHDPROXF 0x3B
ToHellWithGeorgi 0:c3c8793d0091 91 #define NCLPROXF 0x3C
ToHellWithGeorgi 0:c3c8793d0091 92 #define FDLPROXF 0x3D
ToHellWithGeorgi 0:c3c8793d0091 93 #define NHDPROXT 0x3E
ToHellWithGeorgi 0:c3c8793d0091 94 #define NCLPROXT 0x3F
ToHellWithGeorgi 0:c3c8793d0091 95 #define FDLPROXT 0x40
ToHellWithGeorgi 0:c3c8793d0091 96 // Electrode Touch/Release thresholds
ToHellWithGeorgi 0:c3c8793d0091 97 #define ELE0_T 0x41
ToHellWithGeorgi 0:c3c8793d0091 98 #define ELE0_R 0x42
ToHellWithGeorgi 0:c3c8793d0091 99 #define ELE1_T 0x43
ToHellWithGeorgi 0:c3c8793d0091 100 #define ELE1_R 0x44
ToHellWithGeorgi 0:c3c8793d0091 101 #define ELE2_T 0x45
ToHellWithGeorgi 0:c3c8793d0091 102 #define ELE2_R 0x46
ToHellWithGeorgi 0:c3c8793d0091 103 #define ELE3_T 0x47
ToHellWithGeorgi 0:c3c8793d0091 104 #define ELE3_R 0x48
ToHellWithGeorgi 0:c3c8793d0091 105 #define ELE4_T 0x49
ToHellWithGeorgi 0:c3c8793d0091 106 #define ELE4_R 0x4A
ToHellWithGeorgi 0:c3c8793d0091 107 #define ELE5_T 0x4B
ToHellWithGeorgi 0:c3c8793d0091 108 #define ELE5_R 0x4C
ToHellWithGeorgi 0:c3c8793d0091 109 #define ELE6_T 0x4D
ToHellWithGeorgi 0:c3c8793d0091 110 #define ELE6_R 0x4E
ToHellWithGeorgi 0:c3c8793d0091 111 #define ELE7_T 0x4F
ToHellWithGeorgi 0:c3c8793d0091 112 #define ELE7_R 0x50
ToHellWithGeorgi 0:c3c8793d0091 113 #define ELE8_T 0x51
ToHellWithGeorgi 0:c3c8793d0091 114 #define ELE8_R 0x52
ToHellWithGeorgi 0:c3c8793d0091 115 #define ELE9_T 0x53
ToHellWithGeorgi 0:c3c8793d0091 116 #define ELE9_R 0x54
ToHellWithGeorgi 0:c3c8793d0091 117 #define ELE10_T 0x55
ToHellWithGeorgi 0:c3c8793d0091 118 #define ELE10_R 0x56
ToHellWithGeorgi 0:c3c8793d0091 119 #define ELE11_T 0x57
ToHellWithGeorgi 0:c3c8793d0091 120 #define ELE11_R 0x58
ToHellWithGeorgi 0:c3c8793d0091 121 // Proximity Touch/Release thresholds
ToHellWithGeorgi 0:c3c8793d0091 122 #define EPROXTTH 0x59
ToHellWithGeorgi 0:c3c8793d0091 123 #define EPROXRTH 0x5A
ToHellWithGeorgi 0:c3c8793d0091 124 // Debounce configuration
ToHellWithGeorgi 0:c3c8793d0091 125 #define DEB_CFG 0x5B
ToHellWithGeorgi 0:c3c8793d0091 126 // AFE- Analogue Front End configuration
ToHellWithGeorgi 0:c3c8793d0091 127 #define AFE_CFG 0x5C
ToHellWithGeorgi 0:c3c8793d0091 128 // Filter configuration
ToHellWithGeorgi 0:c3c8793d0091 129 #define FIL_CFG 0x5D
ToHellWithGeorgi 0:c3c8793d0091 130 // Electrode configuration - transistions to "active mode"
ToHellWithGeorgi 0:c3c8793d0091 131 #define ELE_CFG 0x5E
ToHellWithGeorgi 0:c3c8793d0091 132
ToHellWithGeorgi 0:c3c8793d0091 133 #define GPIO_CTRL0 0x73
ToHellWithGeorgi 0:c3c8793d0091 134 #define GPIO_CTRL1 0x74
ToHellWithGeorgi 0:c3c8793d0091 135 #define GPIO_DATA 0x75
ToHellWithGeorgi 0:c3c8793d0091 136 #define GPIO_DIR 0x76
ToHellWithGeorgi 0:c3c8793d0091 137 #define GPIO_EN 0x77
ToHellWithGeorgi 0:c3c8793d0091 138 #define GPIO_SET 0x78
ToHellWithGeorgi 0:c3c8793d0091 139 #define GPIO_CLEAR 0x79
ToHellWithGeorgi 0:c3c8793d0091 140 #define GPIO_TOGGLE 0x7A
ToHellWithGeorgi 0:c3c8793d0091 141 // Auto configration registers
ToHellWithGeorgi 0:c3c8793d0091 142 #define AUTO_CFG_0 0x7B
ToHellWithGeorgi 0:c3c8793d0091 143 #define AUTO_CFG_U 0x7D
ToHellWithGeorgi 0:c3c8793d0091 144 #define AUTO_CFG_L 0x7E
ToHellWithGeorgi 0:c3c8793d0091 145 #define AUTO_CFG_T 0x7F
ToHellWithGeorgi 0:c3c8793d0091 146
ToHellWithGeorgi 0:c3c8793d0091 147 // Threshold defaults
ToHellWithGeorgi 0:c3c8793d0091 148 // Electrode touch threshold
ToHellWithGeorgi 0:c3c8793d0091 149 #define E_THR_T 0x0F
ToHellWithGeorgi 0:c3c8793d0091 150 // Electrode release threshold
ToHellWithGeorgi 0:c3c8793d0091 151 #define E_THR_R 0x0A
ToHellWithGeorgi 0:c3c8793d0091 152 // Prox touch threshold
ToHellWithGeorgi 0:c3c8793d0091 153 #define PROX_THR_T 0x02
ToHellWithGeorgi 0:c3c8793d0091 154 // Prox release threshold
ToHellWithGeorgi 0:c3c8793d0091 155 #define PROX_THR_R 0x02
ToHellWithGeorgi 0:c3c8793d0091 156
ToHellWithGeorgi 0:c3c8793d0091 157 #endif