Example #1
0
unsigned char RS232_ECD(unsigned char COM_PORT){
  
   unsigned char RS232_Input =0; 
   terminalemulator(); //reset current terminal emulator 
    printf("\n INTERRUPTS DISABLED !!!!!!\n"); 
    printf("\n Begin Communication with COM%d",COM_PORT);
    printf("\n BaudRate: %lu ", RS232_BAUD_RATE);   
    printf("\n Control Reg 1: %d     Control Reg 2: %d",RS232_CONTROL_REG, RS232_CONTROL_REG2); 
    printf("\n Begin Input: ");
    asm("SEI"); // DISABLE INTERRUPTS FOR RS232  
   for(;;){
     RS232_Input = RS232_Read();
     printf("%c", RS232_Input); 
   }

  return 0; 
} 
Example #2
0
void ILI9327_INIT(void){
     ILI9327_INITALIZE();   
      
  terminalemulator();            
     return; 
}
// program entry point
int main()
{   
    int errCode; 
	struct LCD_Geometry *pointCurrent= &Current;
    struct LCD_Properties *pointProperties = &Properties;
    FILE lcd_str = FDEV_SETUP_STREAM(TerminalChar, NULL, _FDEV_SETUP_RW);
    stdout = &lcd_str;
	
	FRESULT rc;				/* Result code */
	DIR dir;				/* Directory object */
	FILINFO fno;			/* File information object */
	UINT bw, br, i;
	
   	USART_init();
   	SPI_MasterInit();
   	
   	SSD1289_Initalize();
	  
   	UTouch_InitTouch(0);
    LCD_Fill_Rectangle(0,0, 320,240,0x000000);
    terminalemulator();
    Terminal_Set_Properties(2, 1, 0xFFFFFF);
	//while(1) 	{ Paint_Program();}
	    
	printf("Serial Default Output");
	/* Init the MMC */
	printf("mmc_init\n");
	 //disk_initialize(0);
	mmc_init();
	
	
	
	/// Drive must be mounted before use  // Drive 0 - signifies SD System 
	/// Halt on anything other than mounting system okay
	errCode = f_mount(0, &filesystem);
	if (errCode != FR_OK)
	{
		printf("Error: f_mount failed, error code: %d\r", errCode);
		printf("Please refer to error list"); 
		while (1); // freeze
	}
	
	printf("\n Mounted File System: Type SD");
	// Draw BMP	
	
	printf("\nCreate a new file (hello.txt).\n");
	rc = f_open(&file, "HELLO.TXT", FA_WRITE | FA_CREATE_ALWAYS);
	
	printf("\nWrite a text data. (Hello world!)\n");
	rc = f_write(&file, "Hello world!\r\n", 14, &bw);
	printf("%u bytes written.\n", bw);

	printf("\nClose the file.\n");
	rc = f_close(&file);

	while(1){
		//printf("\nOpen root directory.\n");
		rc = f_opendir(&dir, "");
		
		//printf("\nDirectory listing...\n");
		for (;;) {
			rc = f_readdir(&dir, &fno);		/* Read a directory item */
			if (rc || !fno.fname[0]) break;	/* Error or end of dir */
		
			if (fno.fattrib & AM_DIR)
				printf("   <dir>  %s\n", fno.fname);
			else
				{
				//printf("%8lu  %s\n", fno.fsize, fno.fname);
				draw_bmp(0,0,fno.fname);
				}
		
		}
	}
}