I am trying to find specific string in another string which is received via UART. However, my function returns 0, although string is not inside uart received string. Here is my function:
bool GetCommand(UART_HandleTypeDef *huart, char *command, char *getCommand, uint8_t size) {
char *ptr;
if (HAL_UART_Receive_IT(huart,command,size) == HAL_OK) {
ptr = strstr(command,getCommand);
}
if (ptr) {
return 1;
} else {
return 0;
}
}
Program works with gcc, but it is not working as I expected when I try it with Keil. Can you help related this issue?