uint16_t TM_BUFFER_ReadString(TM_BUFFER_t* Buffer, char* buff, uint16_t buffsize) {
	uint16_t i = 0;
	uint8_t ch;
	uint16_t freeMem;
	
	/* Check value buffer */
	if (Buffer == NULL) {
		return 0;
	}
	
	/* Get free */
	freeMem = TM_BUFFER_GetFree(Buffer);
	
	/* Check for any data on USART */
	if (
		freeMem == 0 ||                                                    /*!< Buffer empty */
		(
			TM_BUFFER_FindElement(Buffer, Buffer->StringDelimiter) == 0 && /*!< String delimiter is not in buffer */
			freeMem != 0 &&                                                /*!< Buffer is not full */
			TM_BUFFER_GetFull(Buffer) < buffsize                           /*!< User buffer size is larger than number of elements in buffer */
		)
	) {
		/* Return 0 */
		return 0;
	}
	
	/* If available buffer size is more than 0 characters */
	while (i < (buffsize - 1)) {
		/* We have available data */
		TM_BUFFER_Read(Buffer, &ch, 1);
		
		/* Save character */
		buff[i] = (char)ch;
		
		/* Check for end of string */
		if ((char)buff[i] == (char)Buffer->StringDelimiter) {
			/* Done */
			break;
		}
		
		/* Increase */
		i++;
	}
	
	/* Add zero to the end of string */
	if (i == (buffsize - 1)) {
		buff[i] = 0;
	} else {
		buff[++i] = 0;
	}

	/* Return number of characters in buffer */
	return i;
}
int16_t TM_USART_FindCharacter(USART_TypeDef* USARTx, uint8_t c) {
	return TM_BUFFER_FindElement(TM_USART_INT_GetUSARTBuffer(USARTx), c);
}