Search the Community
Showing results for tags 'spi j16'.
-
Hi all, I will not use the SDcard. I will use a capacitive touch sensor TTP229 at 2 wires(16 keys). http://www.tontek.com.tw/download.asp?sn=726 I was able to use the sensor on the J16. using the "SI" and "SC" pin. How to configure the J16 pins for two "SI" inputs?Or how to configure II2C and I2S for SI and SC? I want to use at least two TTP229 Below the code for J16 PIN SI. mios32_config.h #define MIOS32_SPI0_IN_INIT { MIOS32_SYS_LPC_PINMODE(1, 24, 2); \ MIOS32_SYS_LPC_PINMODE(1, 23, 0); \ MIOS32_SYS_LPC_PINMODE(1, 22, 2); \ MIOS32_SYS_LPC_PINMODE(1, 21, 2); \ MIOS32_SYS_LPC_PINMODE(1, 20, 2); } APP.C u8 receive; u8 receive1; u8 flag1=0; u8 flag2=0; char valor1; char valor2; void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); MIOS32_SPI_Init(0); MIOS32_SPI_IO_Init(0,MIOS32_SPI_PIN_DRIVER_STRONG); MIOS32_SPI_TransferModeInit(0,MIOS32_SPI_MODE_CLK1_PHASE1,MIOS32_SPI_PRESCALER_8); } void APP_Tick(void) { receive=MIOS32_SPI_TransferByte(0,receive); /////valor 255 if not pressed receive1=MIOS32_SPI_TransferByte(0,receive1);////valor 255 if not pressed if(receive<255 && flag1==0)//////if pressed { valor1=receive-127; MIOS32_MIDI_SendNoteOn(DEFAULT, Chn4, valor1, 127); flag1=1; // MIOS32_MIDI_SendDebugMessage("Recebido:%u FLAG1:%u\n",valor1, flag1); } if(receive==255 && flag1==1 ) { MIOS32_MIDI_SendNoteOff(DEFAULT, Chn4, valor1, 0); flag1=0; } if(receive1<255 && flag2==0)//////if pressed { valor2=receive1-127; MIOS32_MIDI_SendNoteOn(DEFAULT, Chn5, valor2, 127); flag2=1; } if(receive1==255 && flag2==1) { MIOS32_MIDI_SendNoteOff(DEFAULT, Chn5, valor2, 0); flag2=0; } } Video Test in Portuguese ...