Example #1
0
/* printf handler */
int fputc(int ch, FILE* fil) {
#if defined(STM32F429_DISCOVERY) || defined(STM32F7_DISCOVERY) || defined(STM32F439_EVAL)
	TM_FONT_t* font = TM_LCD_GetFont();
	uint16_t currY = TM_LCD_GetCurrentY();
	
	/* Try to put character */
	if (TM_LCD_Putc(ch) != TM_LCD_Result_Ok) {
		/* Clear screen */
		TM_LCD_Fill(LCD_COLOR_WHITE);
		
		/* Go to beginning of LCD */
		TM_LCD_SetXY(5, 5);
		
		/* Try again */
		TM_LCD_Putc(ch);
	}
	
	/* Return OK */
	return ch;
#else
	return EOF;
#endif
}
TM_LCD_Result_t TM_LCD_Puts(char* str) {
	/* Send till string ends or error returned */
	while (*str) {
		/* Check if string OK */
		if (TM_LCD_Putc(*str) != TM_LCD_Result_Ok) {
			/* Return error */
			return TM_LCD_Result_Error;
		}
		
		/* Increase pointer */
		str++;
	}
	
	/* Return OK */
	return TM_LCD_Result_Ok;
}
uint8_t TM_FATFS_SearchCallback(char* path, uint8_t is_file, TM_FATFS_Search_t* FindStructure) {
	/* Print on LCD */
	TM_LCD_Puts(path);
	
	/* Delete file on card */
	if (f_unlink(path) == FR_OK) {
		TM_LCD_Puts("; Delete OK!");
	} else {
		TM_LCD_Puts("; Delete Error!");
	}
	
	/* Go to new line */
	TM_LCD_Putc('\n');
	
	/* Allow next search */
	return 1;
}