Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player_copy
Fork of rtos_basic by
Revision 7:a935e2f5ebd0, committed 2016-11-03
- Comitter:
- decfrv
- Date:
- Thu Nov 03 14:45:00 2016 +0000
- Parent:
- 6:209f4db62daf
- Commit message:
- Sudoku Game
Changed in this revision
diff -r 209f4db62daf -r a935e2f5ebd0 4DGL-uLCD-SE.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/4DGL-uLCD-SE.lib Thu Nov 03 14:45:00 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/4180_1/code/4DGL-uLCD-SE/#2cb1845d7681
diff -r 209f4db62daf -r a935e2f5ebd0 SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Thu Nov 03 14:45:00 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec
diff -r 209f4db62daf -r a935e2f5ebd0 main.cpp --- a/main.cpp Tue Jun 04 16:01:32 2013 +0100 +++ b/main.cpp Thu Nov 03 14:45:00 2016 +0000 @@ -1,21 +1,392 @@ #include "mbed.h" +#include <mpr121.h> #include "rtos.h" +#include "uLCD_4DGL.h" +#include "wave_player.h" +#include "SDFileSystem.h" + + class Nav_Switch +{ +public: + Nav_Switch(PinName up,PinName down,PinName left,PinName right,PinName fire); + int read(); +//boolean functions to test each switch + bool up(); + bool down(); + bool left(); + bool right(); + bool fire(); +//automatic read on RHS + operator int (); +//index to any switch array style + bool operator[](int index) { + return _pins[index]; + }; +private: + BusIn _pins; + +}; +Nav_Switch::Nav_Switch (PinName up,PinName down,PinName left,PinName right,PinName fire): + _pins(up, down, left, right, fire) +{ + _pins.mode(PullUp); //needed if pullups not on board or a bare nav switch is used - delete otherwise + wait(0.001); //delays just a bit for pullups to pull inputs high +} +inline bool Nav_Switch::up() +{ + return !(_pins[0]); +} +inline bool Nav_Switch::down() +{ + return !(_pins[1]); +} +inline bool Nav_Switch::left() +{ + return !(_pins[2]); +} +inline bool Nav_Switch::right() +{ + return !(_pins[3]); +} +inline bool Nav_Switch::fire() +{ + return !(_pins[4]); +} +inline int Nav_Switch::read() +{ + return _pins.read(); +} +inline Nav_Switch::operator int () +{ + return _pins.read(); +} DigitalOut led1(LED1); DigitalOut led2(LED2); - -void led2_thread(void const *args) { - while (true) { - led2 = !led2; - Thread::wait(1000); +DigitalOut led3(LED3); +DigitalOut led4(LED4); +uLCD_4DGL uLCD(p28,p27,p30); +Serial pc(USBTX, USBRX); + +SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card +DigitalIn sddetect(p9); + +Nav_Switch myNav( p16, p19, p15, p20, p17); //pin order on Sparkfun breakout + +//number pad +InterruptIn interrupt(p21); +I2C i2c(p9, p10); +Mpr121 mpr121(&i2c, Mpr121::ADD_VSS); + +AnalogOut DACout(p18); +wave_player waver(&DACout); + +Mutex lcdMutex; + + + +int xndx; +int yndx; + +static int nums [9][9] = {{0,5,4, 9,3,8, 2,7,6}, + {6,7,9, 1,4,2, 8,3,5}, + {8,2,3, 7,5,6, 4,9,1}, + + {4,8,5, 2,7,9, 6,1,3}, + {7,3,1, 6,0,4, 5,2,9}, + {9,6,2, 3,1,5, 7,8,4}, + + {5,1,6, 0,2,3, 9,4,7}, + {2,9,7, 4,6,1, 3,5,8}, + {3,4,8, 5,9,7, 1,6,2}}; + + +bool preset[9][9] = {}; + +bool interruptChange = false; +int interruptNum = -1; + +// Key hit/release interrupt routine +void fallInterrupt() { + + int value=mpr121.read(0x00); + value +=mpr121.read(0x01)<<8; + + int number = 0; + if ((value>>9) & 0x01) { + number = 9; + } else if ((value>>8) & 0x01) { + number = 8; + } else if ((value>>7) & 0x01) { + number = 7; + } else if ((value>>6) & 0x01) { + number = 6; + } else if ((value>>5) & 0x01) { + number = 5; + } else if ((value>>4) & 0x01) { + number = 4; + } else if ((value>>3) & 0x01) { + number = 3; + } else if ((value>>2) & 0x01) { + number = 2; + } else if ((value>>1) & 0x01) { + number = 1; + } else if (value & 0x01) { + number = 0; + } + + if (!preset[yndx][xndx]) { + interruptNum = number; + //nums[yndx][xndx] = number; + interruptChange = true; + } +} + +int main() { + nums[0][0] = 1; + interrupt.fall(&fallInterrupt); + interrupt.mode(PullUp); + + uLCD.background_color(WHITE); + uLCD.cls(); + uLCD.color(BLACK); + uLCD.text_height(1); + uLCD.text_width(1); + uLCD.textbackground_color(WHITE); + //uLCD.printf("1 2 3 4 5 6 7 8 9\n\n1 2 3 4 5 6 7 8 9\n\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n\n1 2 3 4 5 6 7 8 9\n\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n\n1 2 3 4 5 6 7 8 9\n\n1 2 3 4 5 6 7 8 9"); + + /*uLCD.filled_triangle(30, 61, 13, 81, 51, 112, GREEN); + uLCD.filled_triangle(30, 61, 51, 112, 66, 92, GREEN); + uLCD.filled_triangle(51, 112, 104, 11, 120, 24, GREEN); + uLCD.filled_triangle(51, 112, 31, 96, 104, 11, GREEN);*/ + + uLCD.color(BLUE); + for (int i = 0; i < 9; i++) { + for (int j = 0; j < 9; j++) { + if (nums[i][j] == 0) { + uLCD.printf(" "); + preset[i][j] = false; + } else { + uLCD.printf("%d ", nums[i][j]); + preset[i][j] = true; + } + } + //uLCD.printf("\n"); + if (i != 2 && i != 5) { + uLCD.printf("\n"); + } + } + uLCD.color(BLACK); + + + uLCD.line(40, 0, 40, 128, BLACK); + uLCD.line(80, 0, 80, 128, BLACK); + uLCD.line(0, 40, 128, 40, BLACK); + uLCD.line(0, 80, 128, 80, BLACK); + + xndx = 0; + yndx = 0; + int oldxndx = 0; + int oldyndx = 0; + bool changed = true; + + bool up = false; + bool down = false; + bool left = false; + bool right = false; + bool fire = false; + //uLCD.rectangle(0,0,7,7, BLUE); + + + bool keepGoing = true; + while (keepGoing) { + //led1 = !led1; + oldyndx = yndx; + oldxndx = xndx; + if(myNav.left() && !up) { + if (yndx > 0) { + //oldyndx=yndx; + //do { + yndx--; + //} while (preset[yndx][xndx] && yndx != 0); + changed = true; + } + up = true; + } else if(myNav.right() && !down) { + if (yndx < 8) { + //oldyndx=yndx; + //do { + yndx++; + //} while (preset[yndx][xndx] && yndx != 8); + changed = true; + } + down = true; + } else if(myNav.down() && !left) { + if (xndx > 0) { + //oldxndx=xndx; + //do { + xndx--; + //} while (preset[yndx][xndx] && xndx != 0); + changed = true; + } + left= true; + } else if(myNav.up() && !right) { + if (xndx < 8) { + //oldxndx=xndx; + //do { + xndx++; + //} while (preset[yndx][xndx] && xndx != 8); + changed = true; + } + right = true; + } else if(myNav.fire() && !fire) { + + bool test = true; + /////////////////////////////////////////////// + pc.printf("5,5: %d\r\n",nums[4][4]); + for (int i = 0; i < 9; i++) { + int sum = 0; + int product = 1; + for (int j = 0; j < 9; j++) { + product *= nums[i][j]; + sum += nums[i][j]; + } + if (sum != 45 || product != 362880) { + test = false; + pc.printf("Bad Row: %d Sum:%d Product:%d\r\n", i + 1, sum, product); + } + } + + for (int i = 0; i < 9; i++) { + int sum = 0; + int product = 1; + for (int j = 0; j < 9; j++) { + product *= nums[j][i]; + sum += nums[j][i]; + } + if (sum != 45 || product != 362880) { + test = false; + pc.printf("Bad Column: %d Sum:%d Product:%d\r\n", i + 1, sum, product); + } + } + + for (int m = 0; m < 3; m++) { + for (int k = 0; k < 3; k++) { + int sum = 0; + int product = 1; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + product *= nums[3*k + i][3*m + j]; + sum += nums[3*k + i][3*m + j]; + } + } + if (sum != 45 || product != 362880) { + test = false; + pc.printf("Bad Box: %d Sum:%d Product:%d\r\n", m*3 + k + 1, sum, product); + } + } + } + if (test) { + //Play Sound + for (int i = 0; i < 20; i++) { + uLCD.line(11+i,81-i, 49+i, 112-i, GREEN); + uLCD.line(12+i,81-i, 50+i, 112-i, GREEN); + uLCD.line(51-i,112-i, 120-i,24-i, GREEN); + uLCD.line(52-i,112-i, 121-i,24-i, GREEN); + } + keepGoing = false; + pc.printf("SUCCESS :)\r\n"); + + FILE *wave_file; + wave_file = fopen("/sd/champs.wav","r"); + bool playing = true; + int vol = 5; + waver.play(wave_file, playing, vol); + } else { + for (int i = 0; i < 20; i++) { + uLCD.line(21+i,15,89+i,118, RED); + uLCD.line(89+i,15,21+i,118, RED); + } + pc.printf("FAILURE :(\r\n"); + FILE *wave_file; + wave_file = fopen("/sd/failure.wav","r"); + bool playing = true; + int vol = 5; + waver.play(wave_file, playing, vol); + //wait(5); + //redraw + uLCD.cls(); + uLCD.color(BLUE); + for (int i = 0; i < 9; i++) { + for (int j = 0; j < 9; j++) { + if (nums[i][j] == 0) { + uLCD.printf(" "); + preset[i][j] = false; + } else { + uLCD.printf("%d ", nums[i][j]); + preset[i][j] = true; + } + } + //uLCD.printf("\n"); + if (i != 2 && i != 5) { + uLCD.printf("\n"); + } + } + uLCD.color(BLACK); + + + uLCD.line(40, 0, 40, 128, BLACK); + uLCD.line(80, 0, 80, 128, BLACK); + uLCD.line(0, 40, 128, 40, BLACK); + uLCD.line(0, 80, 128, 80, BLACK); + } + + /////////////////////////////////////////////// + fire = true; + } else { + up = false; + down = false; + left = false; + right = false; + fire = false; + } + + if (changed) { + int xpoint = xndx * 14; + int ypoint = yndx * 16 - (yndx/3) * 8; + int oxpoint = oldxndx * 14; + int oypoint = oldyndx * 16 - (oldyndx/3) * 8; + + uLCD.rectangle(oxpoint,oypoint-1,oxpoint+7,oypoint+7, WHITE); + uLCD.rectangle(xpoint,ypoint-1,xpoint+7,ypoint+7, BLUE); + changed = false; + } + //pc.printf("Joystick: %d %d %d %d %d\n\r", myNav[0], myNav[1], myNav[2], myNav[3], myNav[4]); + //int number = -1; + if (interruptChange && nums[yndx][xndx] != 0 && !preset[yndx][xndx]) { + //number = nums[yndx][xndx]; + //pc.printf("Number: %d\r\n", nums[yndx][xndx]); + uLCD.locate(xndx * 2, yndx *2 - (yndx/3)); + uLCD.printf("%d", nums[yndx][xndx]); + interruptChange = false; + + //pc.printf("Test: %d\r\n", nums[yndx][xndx]); + + int xpoint = xndx * 14; + int ypoint = yndx * 16 - (yndx/3) * 8; + uLCD.rectangle(xpoint,ypoint-1,xpoint+7,ypoint+7, BLUE); + } + if (interruptNum != -1 && interruptNum != 0) { + //pc.printf("Setting 5,5 as %d\r\n", interruptNum); + nums[yndx][xndx] = interruptNum; + interruptNum = -1; + FILE *wave_file; + wave_file = fopen("/sd/beep.wav","r"); + bool playing = true; + int vol = 5; + waver.play(wave_file, playing, vol); + } + //pc.printf("Test2: %d\r\n", nums[yndx][xndx]); + wait(0.1); } } - -int main() { - Thread thread(led2_thread); - - while (true) { - led1 = !led1; - Thread::wait(500); - } -}
diff -r 209f4db62daf -r a935e2f5ebd0 mbed-rtos.lib --- a/mbed-rtos.lib Tue Jun 04 16:01:32 2013 +0100 +++ b/mbed-rtos.lib Thu Nov 03 14:45:00 2016 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/mbed-rtos/ \ No newline at end of file +https://mbed.org/users/mbed_official/code/mbed-rtos/#3da5f554d8bf
diff -r 209f4db62daf -r a935e2f5ebd0 mbed.bld --- a/mbed.bld Tue Jun 04 16:01:32 2013 +0100 +++ b/mbed.bld Thu Nov 03 14:45:00 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file
diff -r 209f4db62daf -r a935e2f5ebd0 mpr121.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpr121.cpp Thu Nov 03 14:45:00 2016 +0000 @@ -0,0 +1,221 @@ +/* +Copyright (c) 2011 Anthony Buckton (abuckton [at] blackink [dot} net {dot} au) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include <mbed.h> +#include <sstream> +#include <string> +#include <list> + +#include <mpr121.h> + +Mpr121::Mpr121(I2C *i2c, Address i2cAddress) +{ + this->i2c = i2c; + + address = i2cAddress; + + // Configure the MPR121 settings to default + this->configureSettings(); +} + + +void Mpr121::configureSettings() +{ + // Put the MPR into setup mode + this->write(ELE_CFG,0x00); + + // Electrode filters for when data is > baseline + unsigned char gtBaseline[] = { + 0x01, //MHD_R + 0x01, //NHD_R + 0x00, //NCL_R + 0x00 //FDL_R + }; + + writeMany(MHD_R,gtBaseline,4); + + // Electrode filters for when data is < baseline + unsigned char ltBaseline[] = { + 0x01, //MHD_F + 0x01, //NHD_F + 0xFF, //NCL_F + 0x02 //FDL_F + }; + + writeMany(MHD_F,ltBaseline,4); + + // Electrode touch and release thresholds + unsigned char electrodeThresholds[] = { + E_THR_T, // Touch Threshhold + E_THR_R // Release Threshold + }; + + for(int i=0; i<12; i++){ + int result = writeMany((ELE0_T+(i*2)),electrodeThresholds,2); + } + + // Proximity Settings + unsigned char proximitySettings[] = { + 0xff, //MHD_Prox_R + 0xff, //NHD_Prox_R + 0x00, //NCL_Prox_R + 0x00, //FDL_Prox_R + 0x01, //MHD_Prox_F + 0x01, //NHD_Prox_F + 0xFF, //NCL_Prox_F + 0xff, //FDL_Prox_F + 0x00, //NHD_Prox_T + 0x00, //NCL_Prox_T + 0x00 //NFD_Prox_T + }; + writeMany(MHDPROXR,proximitySettings,11); + + unsigned char proxThresh[] = { + PROX_THR_T, // Touch Threshold + PROX_THR_R // Release Threshold + }; + writeMany(EPROXTTH,proxThresh,2); + + this->write(FIL_CFG,0x04); + + // Set the electrode config to transition to active mode + this->write(ELE_CFG,0x0c); +} + +void Mpr121::setElectrodeThreshold(int electrode, unsigned char touch, unsigned char release){ + + if(electrode > 11) return; + + // Get the current mode + unsigned char mode = this->read(ELE_CFG); + + // Put the MPR into setup mode + this->write(ELE_CFG,0x00); + + // Write the new threshold + this->write((ELE0_T+(electrode*2)), touch); + this->write((ELE0_T+(electrode*2)+1), release); + + //Restore the operating mode + this->write(ELE_CFG, mode); +} + + +unsigned char Mpr121::read(int key){ + + unsigned char data[2]; + + //Start the command + i2c->start(); + + // Address the target (Write mode) + int ack1= i2c->write(address); + + // Set the register key to read + int ack2 = i2c->write(key); + + // Re-start for read of data + i2c->start(); + + // Re-send the target address in read mode + int ack3 = i2c->write(address+1); + + // Read in the result + data[0] = i2c->read(0); + + // Reset the bus + i2c->stop(); + + return data[0]; +} + + +int Mpr121::write(int key, unsigned char value){ + + //Start the command + i2c->start(); + + // Address the target (Write mode) + int ack1= i2c->write(address); + + // Set the register key to write + int ack2 = i2c->write(key); + + // Read in the result + int ack3 = i2c->write(value); + + // Reset the bus + i2c->stop(); + + return (ack1+ack2+ack3)-3; +} + + +int Mpr121::writeMany(int start, unsigned char* dataSet, int length){ + //Start the command + i2c->start(); + + // Address the target (Write mode) + int ack= i2c->write(address); + if(ack!=1){ + return -1; + } + + // Set the register key to write + ack = i2c->write(start); + if(ack!=1){ + return -1; + } + + // Write the date set + int count = 0; + while(ack==1 && (count < length)){ + ack = i2c->write(dataSet[count]); + count++; + } + // Stop the cmd + i2c->stop(); + + return count; +} + + +bool Mpr121::getProximityMode(){ + if(this->read(ELE_CFG) > 0x0c) + return true; + else + return false; +} + +void Mpr121::setProximityMode(bool mode){ + this->write(ELE_CFG,0x00); + if(mode){ + this->write(ELE_CFG,0x30); //Sense proximity from ALL pads + } else { + this->write(ELE_CFG,0x0c); //Sense touch, all 12 pads active. + } +} + + +int Mpr121::readTouchData(){ + return this->read(0x00); +} \ No newline at end of file
diff -r 209f4db62daf -r a935e2f5ebd0 mpr121.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpr121.h Thu Nov 03 14:45:00 2016 +0000 @@ -0,0 +1,157 @@ +/* +Copyright (c) 2011 Anthony Buckton (abuckton [at] blackink [dot} net {dot} au) + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + Parts written by Jim Lindblom of Sparkfun + Ported to mbed by A.Buckton, Feb 2011 +*/ + +#ifndef MPR121_H +#define MPR121_H + +//using namespace std; + +class Mpr121 +{ + +public: + // i2c Addresses, bit-shifted + enum Address { ADD_VSS = 0xb4,// ADD->VSS = 0x5a <-wiring on Sparkfun board + ADD_VDD = 0xb6,// ADD->VDD = 0x5b + ADD_SCL = 0xb8,// ADD->SDA = 0x5c + ADD_SDA = 0xba // ADD->SCL = 0x5d + }; + + // Real initialiser, takes the i2c address of the device. + Mpr121(I2C *i2c, Address i2cAddress); + + bool getProximityMode(); + + void setProximityMode(bool mode); + + int readTouchData(); + + unsigned char read(int key); + + int write(int address, unsigned char value); + int writeMany(int start, unsigned char* dataSet, int length); + + void setElectrodeThreshold(int electrodeId, unsigned char touchThreshold, unsigned char releaseThreshold); + +protected: + // Configures the MPR with standard settings. This is permitted to be overwritten by sub-classes. + void configureSettings(); + +private: + // The I2C bus instance. + I2C *i2c; + + // i2c address of this mpr121 + Address address; +}; + + +// MPR121 Register Defines +#define MHD_R 0x2B +#define NHD_R 0x2C +#define NCL_R 0x2D +#define FDL_R 0x2E +#define MHD_F 0x2F +#define NHD_F 0x30 +#define NCL_F 0x31 +#define FDL_F 0x32 +#define NHDT 0x33 +#define NCLT 0x34 +#define FDLT 0x35 +// Proximity sensing controls +#define MHDPROXR 0x36 +#define NHDPROXR 0x37 +#define NCLPROXR 0x38 +#define FDLPROXR 0x39 +#define MHDPROXF 0x3A +#define NHDPROXF 0x3B +#define NCLPROXF 0x3C +#define FDLPROXF 0x3D +#define NHDPROXT 0x3E +#define NCLPROXT 0x3F +#define FDLPROXT 0x40 +// Electrode Touch/Release thresholds +#define ELE0_T 0x41 +#define ELE0_R 0x42 +#define ELE1_T 0x43 +#define ELE1_R 0x44 +#define ELE2_T 0x45 +#define ELE2_R 0x46 +#define ELE3_T 0x47 +#define ELE3_R 0x48 +#define ELE4_T 0x49 +#define ELE4_R 0x4A +#define ELE5_T 0x4B +#define ELE5_R 0x4C +#define ELE6_T 0x4D +#define ELE6_R 0x4E +#define ELE7_T 0x4F +#define ELE7_R 0x50 +#define ELE8_T 0x51 +#define ELE8_R 0x52 +#define ELE9_T 0x53 +#define ELE9_R 0x54 +#define ELE10_T 0x55 +#define ELE10_R 0x56 +#define ELE11_T 0x57 +#define ELE11_R 0x58 +// Proximity Touch/Release thresholds +#define EPROXTTH 0x59 +#define EPROXRTH 0x5A +// Debounce configuration +#define DEB_CFG 0x5B +// AFE- Analogue Front End configuration +#define AFE_CFG 0x5C +// Filter configuration +#define FIL_CFG 0x5D +// Electrode configuration - transistions to "active mode" +#define ELE_CFG 0x5E + +#define GPIO_CTRL0 0x73 +#define GPIO_CTRL1 0x74 +#define GPIO_DATA 0x75 +#define GPIO_DIR 0x76 +#define GPIO_EN 0x77 +#define GPIO_SET 0x78 +#define GPIO_CLEAR 0x79 +#define GPIO_TOGGLE 0x7A +// Auto configration registers +#define AUTO_CFG_0 0x7B +#define AUTO_CFG_U 0x7D +#define AUTO_CFG_L 0x7E +#define AUTO_CFG_T 0x7F + +// Threshold defaults +// Electrode touch threshold +#define E_THR_T 0x0F +// Electrode release threshold +#define E_THR_R 0x0A +// Prox touch threshold +#define PROX_THR_T 0x02 +// Prox release threshold +#define PROX_THR_R 0x02 + +#endif
diff -r 209f4db62daf -r a935e2f5ebd0 wave_player_copy.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wave_player_copy.lib Thu Nov 03 14:45:00 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/decfrv/code/wave_player_copy/#90454b75f0ad