capacitive touch CPT112s interface with STM32 using I2C not working
Hi,
As we were trying to interface CPT112s capacitive touch controller with STM32 using I2C,
we were able to get the I2C working...but I was not able to get touch event (either 1 or any high value)
Below is my address reference for both device and memory.
uint16_t DevAddress1 = 0xC0<<1;
uint16_t MemAddress1 = 0xC0200000;
uint8_t mac_id_buf[6] = "";
char print_msg[100] = "";
if(HAL_OK == HAL_I2C_IsDeviceReady(&hi2c1,DevAddress1,200,2000)){
if(HAL_OK == HAL_I2C_Mem_Read(&hi2c1,DevAddress1,MemAddress1,I2C_MEMADD_SIZE_8BIT,(uint8_t*)&mac_id_buf[0],0x0006,HAL_MAX_DELAY)) {
strcpy(print_msg,"SUCCESS HAL_I2C_Mem_Read\r\n");
HAL_UART_Transmit(&huart5,(uint8_t*)print_msg,strlen(print_msg),1000);
sprintf(print_msg,"%X %X %X %X %X %X\r\n", mac_id_buf[0],mac_id_buf[1],mac_id_buf[2],mac_id_buf[3],mac_id_buf[4],mac_id_buf[5]);
HAL_UART_Transmit(&huart5,(uint8_t*)print_msg,strlen(print_msg),1000);
}
else{
strcpy(print_msg,"ERROR in HAL_I2C_Mem_Read()\r\n");
}
}
else{
strcpy(print_msg,"ERROR in HAL_I2C_IsDeviceReady()\r\n");
}
Kindly let me know what changes needed to be done so that I can get the capactive sense value .
Thanks and regards
Ravi chandra
