From 1396d24f579fbf52ec9166ca0a3f1d8edab6cdfd Mon Sep 17 00:00:00 2001 From: id101010 Date: Wed, 13 May 2015 01:34:26 +0200 Subject: [PATCH] Working touchcontroller communication --- discovery/src/ll_touch.c | 134 ++++++++++++--------------------------- 1 file changed, 42 insertions(+), 92 deletions(-) diff --git a/discovery/src/ll_touch.c b/discovery/src/ll_touch.c index 0b98c21..7192661 100644 --- a/discovery/src/ll_touch.c +++ b/discovery/src/ll_touch.c @@ -2,73 +2,9 @@ #include #include - #define CLEAR_CS GPIO_ResetBits(GPIOB,GPIO_Pin_9) #define SET_CS GPIO_SetBits(GPIOB,GPIO_Pin_9) - -/* -static void touch_read(const uint16_t RegisterStartAddress, const uint8_t NumberOfRegisters, uint16_t *DataBuffer, const uint16_t OffsetInBuffer) -{ - uint16_t ControlValue; - uint8_t i,j, RegisterIndex; - uint16_t InputValue; - - ControlValue = 0xE400 | (RegisterStartAddress & 0x03FF); // Create the 16-bit header - - for (i=0;i<100;i++); // delay - - //Write out the control word - CLEAR_CS; - SPI_I2S_SendData(SPI1, ControlValue); - while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY) != RESET); - while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET); - InputValue = SPI_I2S_ReceiveData(SPI1); // Read dummy - - //Copy each register in the buffer contiguously. - //Read data in. - for (RegisterIndex=0; RegisterIndex