Exemple #1
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr");
   lcdSetCursor(5, 0);
   printf("Press user button\r\nto run test");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

      //Loop delay
      osDelayTask(500);
   }
}
Exemple #2
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Display IPv4 address
   lcdSetCursor(2, 0);
   printf("IPv4 Addr");
   lcdSetCursor(5, 0);
   printf("Press user button\r\nto run test");

   //Endless loop
   while(1)
   {
      //Refresh IPv4 address
      lcdSetCursor(3, 0);
      printf("%-16s", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //Up button pressed?
      if(!(PIO_BT_UP->PIO_PDSR & BT_UP))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the up button to be released
         while(!(PIO_BT_UP->PIO_PDSR & BT_UP));
      }

      //100ms delay
      osDelay(100);
   }
}
Exemple #3
0
void lcdFillRect_FSMC(JsGraphics *gfx, short x1, short y1, short x2, short y2) {
  if (x1>x2) {
    short l=x1; x1 = x2; x2 = l;
  }
  if (y1>y2) {
    short l=y1; y1 = y2; y2 = l;
  }
  // offscreen
  if (x1>=gfx->data.width || y1>=gfx->data.height || x2<0 || y2<0) return;
  // now clip
  if (x1<0) x1=0;
  if (y1<0) y1=0;
  if (x2>=gfx->data.width) x2=gfx->data.width-1;
  if (y2>=gfx->data.height) y2=gfx->data.height-1;
  // finally!
  if (x1==x2) { // special case for single vertical line - no window needed
    lcdSetCursor(gfx,x2,y1);
    LCD_WR_REG(0x22); // start data tx
    unsigned int i=0, l=(1+y2-y1);
    LCD_WR_Data_multi(gfx->data.fgColor, l);
  } else {
    lcdSetWindow(gfx,x1,y1,x2,y2);
    lcdSetCursor(gfx,x2,y1);
    LCD_WR_REG(0x22); // start data tx
    unsigned int i=0, l=(1+x2-x1)*(1+y2-y1);
    LCD_WR_Data_multi(gfx->data.fgColor, l);
    lcdSetFullWindow(gfx);
  }
}
Exemple #4
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(5, 0);
   printf("Press user button\r\nto run test\r\n");

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //Up button pressed?
      //if(!(PIO_BT_UP->PIO_PDSR & BT_UP))
      {
         //SSL client test routine
         sslClientTest();

         //Wait for the up button to be released
         //while(!(PIO_BT_UP->PIO_PDSR & BT_UP));
      }

      //Loop delay
      osDelayTask(5000);
   }
}
Exemple #5
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(5, 0);
   printf("Press user button\r\nto run test\r\n");

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //User button pressed?
      if(!STM_EVAL_PBGetState(BUTTON_KEY))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the user button to be released
         while(!STM_EVAL_PBGetState(BUTTON_KEY));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Exemple #6
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr\r\n");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

      lcdSetCursor(5, 0);
      printf("button=%d\r\n", GPIO_ReadBit(GPIO5, GPIO_Pin_4));
      //Loop delay
      osDelayTask(100);
   }
}
Exemple #7
0
void objectMoveLeft(struct object *a)
{
	lcdSetWindow(a->x, a->x + a->height - 1, a->y + a->width - 1, a->y + a->width - 1);
	lcdSetCursor(a->x, a->y + a->width - 1);
	lcdPixelsDraw(a->height, BACKGROUND_COLOUR);
	lcdSetWindow(a->x, a->x + a->height - 1, a->y - 1, a->y - 1);
	lcdSetCursor(a->x, a->y - 1);
	lcdPixelsDraw(a->height, a->red, a->green, a->blue);
	a->y--;
}
Exemple #8
0
void objectMoveDown(struct object *a)
{
	lcdSetWindow(a->x, a->x, a->y, a->y + a->width - 1);
	lcdSetCursor(a->x, a->y);
	lcdPixelsDraw(a->width, BACKGROUND_COLOUR);
	lcdSetWindow(a->x + a->height, a->x + a->height, a->y, a->y + a->width - 1);
	lcdSetCursor(a->x + a->height, a->y);
	lcdPixelsDraw(a->width, a->red, a->green, a->blue);
	a->x++;
}
Exemple #9
0
void Screen::displayAnimation()
{
    for (uint8_t i=0; i<16; i++) {
        lcdSetCursor(15-i,1);
        lcdPrintChar(255);
        lcdSetCursor(i,0);
        lcdPrintChar(255);
        Time::delayDoIdle(10);
    }
}
Exemple #10
0
void greenAndRed(void){
	greenDirection = 1;
	interval = 2800;
	level = 0;
	extTIrqHandler = gnrTIrqHandler;
	extKIrqHandler = gnrKIrqHandler;
	lcdSetCursor(0,0);
	lcdPixelsDraw(240*320, BACKGROUND_COLOUR);
	lcdSetBackgroundColour(BACKGROUND_COLOUR);
	lcdSetFontColour(BRICK_COLOUR);
	lcdPrint(10,10, "LEVEL 0");
	objectDraw(&brick, 50, 152);
	objectDraw(&flier, 150, 10);
	greenCounter = 0;
	redCounter = 0;
	timerSetMatch(interval);

	while(1){
		
		irqDisableSec();
		lcdSetFontColour(BRICK_COLOUR);
		lcdDrawChar(10, 246, (char)(greenCounter+48));
		lcdSetFontColour(63, 0, 0);
		lcdDrawChar(10, 294, (char)(redCounter+48));
		irqEnableSec();
		waitCycles(0x6fffff);	
		lcdFillWindow(10, 26, 246, 310, BACKGROUND_COLOUR);
		waitCycles(0x6fffff);	
	}	


}
Exemple #11
0
void LCDInit(void)
{
	lcdInit();
	lcdClear();
	lcdSetCursor(LCD_CURSOR_BLINK);
	lcd_px = lcd_py = 0;
}
Exemple #12
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(1, 0);
      printf("%-16s", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //SW1 pressed?
      if(!(MSS_GPIO_get_inputs() & (1 << MSS_GPIO_8)))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for SW1 to be released
         while(!(MSS_GPIO_get_inputs() & (1 << MSS_GPIO_8)));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Exemple #13
0
/**
 * Move LCD window cursor around and do the same with lcd cursor
 */
void lcdWindowCursor(t_I2Lcd *lcd, struct panelw *p, int col, int row)
{
    wmove(p->win, row + 1, col + 1);
    lcdSetCursor(lcd, col, row);
    p->row = row;
    p->col = col;
}
Exemple #14
0
void objectDraw(struct object *a, unsigned short int x, unsigned short int y)
{
	lcdSetWindow(x, x + a->height - 1, y, y + a->width - 1);
	lcdSetCursor(x, y);
	lcdPixelsDraw(a->width * a->height, a->red, a->green, a->blue);
	a->x = x;
	a->y = y;
}
Exemple #15
0
error_t sntpClientTest(void)
{
   error_t error;
   time_t unixTime;
   IpAddr ipAddr;
   NtpTimestamp timestamp;
   DateTime date;

   //Debug message
   TRACE_INFO("\r\n\r\nResolving server name...\r\n");
   //Resolve SNTP server name
   error = getHostByName(NULL, "0.fr.pool.ntp.org", &ipAddr, 0);

   //Any error to report?
   if(error)
   {
      //Debug message
      TRACE_INFO("Failed to resolve server name!\r\n");
      //Exit immediately
      return error;
   }

   //Debug message
   TRACE_INFO("Requesting time from SNTP server %s\r\n", ipAddrToString(&ipAddr, NULL));
   //Retrieve current time from NTP server using SNTP protocol
   error = sntpClientGetTimestamp(NULL, &ipAddr, &timestamp);

   //Any error to report?
   if(error)
   {
      //Debug message
      TRACE_INFO("Failed to retrieve NTP timestamp!\r\n");
   }
   else
   {
      //Unix time starts on January 1st, 1970
      unixTime = timestamp.seconds - 2208988800;
      //Convert Unix timestamp to date
      convertUnixTimeToDate(unixTime, &date);

      //Debug message
      TRACE_INFO("Current date/time: %s\r\n", formatDate(&date, NULL));

      //Move cursor
      lcdSetCursor(8, 0);

      //Refresh LCD display
      printf("%04u/%02u/%02u %02u:%02u:%02u", date.year, date.month,
         date.day, date.hours, date.minutes, date.seconds);
   }

   //Return status code
   return error;
}
void run() {

    uint32_t t;
    int j = 0;
    int dir = 1;
    do {
        t = Time::getMiliseconds();
        Utils::delayMicroseconds(50000);
        t = Time::getMiliseconds() - t;
        lcdSetCursor(0,0);
        lcdPrintUInt(t);
        lcdPrintSpaces();
        lcdSetCursor(0,1);
        for(int i=0;i<16;i++) {
            lcdPrintChar(' '+i+j);
        }
        j+=dir;
        if(j>128-16 - ' ' || j < 1) dir *= -1;

    } while(true);
}
Exemple #17
0
/*** Function    : main
**   Parameters  : None
**   Return      : int
**   Description : It is entry point of program
**/
int main(void)
{
	stopWatchDog();
	lcdBegin();                       // Initiate the LCD
	while(1)
	{
    #if _LCD_TYPE_ == 1
	lcdSetCursor(1,0);
    lcdPrint(String1);
    __delay_ms__(LCD_REFRESH_DELAY);
    lcdSetCursor(2,0);
    lcdPrint(String2);
    __delay_ms__(LCD_REFRESH_DELAY);
    lcdSetCursor(3,0);
    lcdPrint(String3);
    __delay_ms__(LCD_REFRESH_DELAY);
    lcdSetCursor(4,0);
    lcdPrint(String4);
    __delay_ms__(LCD_REFRESH_DELAY);
    lcdClear();
    __delay_ms__(LCD_REFRESH_DELAY);
    #elif _LCD_TYPE_ == 2
	lcdSetCursor(1,0);
    lcdPrint(String1);
    __delay_ms__(LCD_REFRESH_DELAY);
    lcdSetCursor(2,0);
    lcdPrint(String2);
    __delay_ms__(LCD_REFRESH_DELAY);
    lcdClear();
    __delay_ms__(LCD_REFRESH_DELAY);
    #endif
	}
}
Exemple #18
0
/* Output a 1 bit bitmap */
void lcdBitmap1bit_FSMC(JsGraphics *gfx, short x1, short y1, unsigned short width, unsigned short height, unsigned char *data) {
  lcdSetWindow(gfx,x1,y1,x1+width-1,y1+height-1);
  lcdSetCursor(gfx,x1+width-1,y1);
  LCD_WR_REG(0x22); // start data tx
  unsigned int x,y;
  for(x=0;x<width;x++) {
    for(y=0;y<height;y++) {
      int bitOffset = x+(y*width);
      LCD_WR_Data(((data[bitOffset>>3]>>(bitOffset&7))&1) ? gfx->data.fgColor : gfx->data.bgColor);
    }
  }
  lcdSetFullWindow(gfx);
}
Exemple #19
0
/**
 * lcd content window activation handler
 */
void lcdActivateHandler(struct panelw *p)
{
    int i;
    const char *row;;

    for(i = 0; i < p->lcd->rows; i++)
    {
	row = lcdReadRow(p->lcd, i);
	mvwprintw(p->win, i + 1, 1, row);
    }
    wmove(p->win, p->row + 1, p->col + 1);
    lcdSetCursor(p->lcd, p->col, p->row);
}
Exemple #20
0
void Menu::display() {
    uint8_t lines = LCD_LINES;
    for(uint8_t i = 0; i < lines; i++) {
        lcdSetCursor(0, i);
        lcdPrintChar(i == pos_ ? '>' : ' ');
        if(i + begin_ < size_) {
            printItem(i + begin_);
        }
        lcdPrintSpaces();
    }
    debug();
    render_ = false;
}
Exemple #21
0
void InputLine::readInput(){
	if(inputActive){
		lcdSetCursor(cursorPoint, row);
		cursorBlinker(); 
	  
		char key = keyPadReadKey();
	  
		switch(currentReadMode){
			case 0: readNumbers(key); break;
			case 1: readLetters(key); break;
			default: break;
		}
	}
}
Exemple #22
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(3, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(6, 0);
   printf("Press SW1 to\r\n");
   lcdSetCursor(7, 0);
   printf("run test\r\n");

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(4, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //SW1 button pressed?
      if(!SW1)
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for SW1 button to be released
         while(!SW1);
      }

      //Loop delay
      osDelayTask(100);
   }
}
Exemple #23
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   lcdSetCursor(2, 0);
   printf("IPv4 Address\r\n");
   lcdSetCursor(5, 0);
   printf("IPv6 Link-Local Address\r\n");
   lcdSetCursor(8, 0);
   printf("IPv6 Global Address\r\n");
   lcdSetCursor(11, 0);
   printf("Press SELECT button to run test\r\n");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

#if (IPV6_SUPPORT == ENABLED)
      //Display IPv6 link-local address
      lcdSetCursor(6, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.linkLocalAddr, buffer));

      //Display IPv6 global address
      lcdSetCursor(9, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.globalAddr, buffer));
#endif

      //SELECT button pressed?
      if(!GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_1))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the SELECT button to be released
         while(!GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_1));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Exemple #24
0
void pacmanGame()
{
	lcdSetBackgroundColour(BACKGROUND_COLOUR);
	lcdSetFontColour(FOREGROUND_COLOUR);
	lcdSetCursor(0, 0);
	lcdPixelsDraw(240 * 320, BACKGROUND_COLOUR);
	lcdPrint(10, 10, "PACMAN");
	wait(1000000);
	lcdPrint(50, 10, "MOVE WITH 2,4,5,6");
	wait(1000000);
	lcdPrint(76, 10, "PRESS A TO START");
	while (kBuffer != 3)
		continue;
	kBuffer = 16;
	lcdFillWindow(0, 239, 0, 319, BACKGROUND_COLOUR);
	lcdPrint(112, 80, "LEVEL 1");
	wait(1000000);
	pacman::lifes = 3;
	while (1) {
		if (level1()) {
			pacman::lifes = 3;
			pacman::score = 0;
			continue;
		}
		if (level2()) {
			pacman::lifes = 3;
			pacman::score = 0;
			continue;
		}

		if (level3()) {
			pacman::lifes = 3;
			pacman::score = 0;
			continue;
		}

		if (level4()) {
			pacman::lifes = 3;
			pacman::score = 0;
			continue;
		}
	}

}
Exemple #25
0
int main(int argc, const char *argv[]) {
	uint8 i;
	uint8 track[4];
	uint8 player[4];

	// Init system clock & disable WDT
	//
	CLKPR = 0x80;
	CLKPR = 0x00;
	MCUSR &= ~(1 << WDRF);
	wdt_disable();

	srand(12345);

	// Init LCD
	//
	lcdInit();

	for ( ; ; ) {
		if ( PIND & 0x80 ) {
			initSelector(32);
			for ( i = 0; i < 4; i++ ) {
				track[i] = selectItem();
			}
			initSelector(NUM_CHARACTERS);
			for ( i = 0; i < 4; i++ ) {
				player[i] = selectItem();
			}
			lcdSetCursor(0,0);
			for ( i = 0; i < 4; i++ ) {
				lcdPrintFlashString(selectCharacter(player[i]));
				lcdPrintFlashString(selectTrack(track[i]));
			}
			while ( PIND & 0x80 );
		} else {
			lcdClearScreen();
			do {
				rand();
			} while ( !(PIND & 0x80) );
		}
	}
}
Exemple #26
0
void printADCData(){ 
            int result = readADCData(); // Read data from ADC
            int resultInMeters = readADCMeter(); //Read data and convert to meters
            if(resultInMeters > 15 && resultInMeters){
                latestReadMeterValue = resultInMeters;
            }  
            if(updateLcdIRData){ // Check LCD refresh rate and print to LCD
                updateLcdIRData = 0;
                lcdSetCursor(0x00);
                //lcdWriteString("Raw:");
                //lcdWriteToDigitBCD(result,4,0);
                //lcdSetCursor(0x09);
                //lcdWriteString("=>");
                lcdWriteToDigitBCD(resultInMeters,3,0); // Write the adc data in meters to LCD
                lcdWriteString("cm");
                
            }
            // Restart the ADC conversion
            startADCConversion();    
}
void userTask(void *param)
{
    char_t buffer[40];

    //Point to the network interface
    NetInterface *interface = &netInterface[0];

    //Initialize LCD display
    lcdSetCursor(2, 0);
    printf("IPv4 Addr\r\n");
    lcdSetCursor(5, 0);
    printf("IPv6 Link-Local Addr\r\n");
    lcdSetCursor(8, 0);
    printf("IPv6 Global Addr\r\n");

    //Endless loop
    while(1)
    {
#if (IPV4_SUPPORT == ENABLED)
        //Display IPv4 host address
        lcdSetCursor(3, 0);
        printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

#if (IPV6_SUPPORT == ENABLED)
        //Display IPv6 link-local address
        lcdSetCursor(6, 0);
        printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.linkLocalAddr, buffer));

        //Display IPv6 global address
        lcdSetCursor(9, 0);
        printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.globalAddr, buffer));
#endif

        //User button pressed?
        if(BSP_PB_GetState(BUTTON_KEY))
        {
            //FTP client test routine
            ftpClientTest();

            //Wait for the user button to be released
            while(BSP_PB_GetState(BUTTON_KEY));
        }

        //Loop delay
        osDelayTask(100);
    }
}
Exemple #28
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(1, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(4, 0);
   printf("IPv6 Link-Local Addr\r\n");
   lcdSetCursor(7, 0);
   printf("IPv6 Global Addr\r\n");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(2, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

#if (IPV6_SUPPORT == ENABLED)
      //Display IPv6 link-local address
      lcdSetCursor(5, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.linkLocalAddr, buffer));

      //Display IPv6 global address
      lcdSetCursor(8, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.globalAddr, buffer));
#endif

      //Start A/D conversion
      adcValue = (1023 - adcGetValue()) * 4;

      //Loop delay
      osDelayTask(500);
   }
}
int_t main(void)
{
    error_t error;
    NetInterface *interface;
    OsTask *task;
    MacAddr macAddr;
#if (APP_USE_DHCP == DISABLED)
    Ipv4Addr ipv4Addr;
#endif
#if (APP_USE_SLAAC == DISABLED)
    Ipv6Addr ipv6Addr;
#endif

    //MPU configuration
    MPU_Config();
    //HAL library initialization
    HAL_Init();
    //Configure the system clock
    SystemClock_Config();

    //Enable I-cache and D-cache
    SCB_EnableICache();
    SCB_EnableDCache();

    //Initialize kernel
    osInitKernel();
    //Configure debug UART
    debugInit(115200);

    //Start-up message
    TRACE_INFO("\r\n");
    TRACE_INFO("**********************************\r\n");
    TRACE_INFO("*** CycloneTCP FTP Client Demo ***\r\n");
    TRACE_INFO("**********************************\r\n");
    TRACE_INFO("Copyright: 2010-2015 Oryx Embedded SARL\r\n");
    TRACE_INFO("Compiled: %s %s\r\n", __DATE__, __TIME__);
    TRACE_INFO("Target: STM32F746\r\n");
    TRACE_INFO("\r\n");

    //LED configuration
    BSP_LED_Init(LED1);
    //Clear LEDs
    BSP_LED_Off(LED1);

    //Initialize user button
    BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);

    //Initialize LCD display
    BSP_LCD_Init();
    BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER_LAYER0);
    BSP_LCD_SelectLayer(0);
    BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
    BSP_LCD_SetFont(&Font24);
    BSP_LCD_DisplayOn();

    //Clear LCD display
    BSP_LCD_Clear(LCD_COLOR_BLUE);

    //Welcome message
    lcdSetCursor(0, 0);
    printf("FTP Client Demo\r\n");

    //TCP/IP stack initialization
    error = netInit();
    //Any error to report?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to initialize TCP/IP stack!\r\n");
    }

    //Configure the first Ethernet interface
    interface = &netInterface[0];

    //Set interface name
    netSetInterfaceName(interface, "eth0");
    //Set host name
    netSetHostname(interface, "FTPClientDemo");
    //Select the relevant network adapter
    netSetDriver(interface, &stm32f7xxEthDriver);
    netSetPhyDriver(interface, &lan8742PhyDriver);
    //Set host MAC address
    macStringToAddr(APP_MAC_ADDR, &macAddr);
    netSetMacAddr(interface, &macAddr);

    //Initialize network interface
    error = netConfigInterface(interface);
    //Any error to report?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to configure interface %s!\r\n", interface->name);
    }

#if (IPV4_SUPPORT == ENABLED)
#if (APP_USE_DHCP == ENABLED)
    //Get default settings
    dhcpClientGetDefaultSettings(&dhcpClientSettings);
    //Set the network interface to be configured by DHCP
    dhcpClientSettings.interface = interface;
    //Disable rapid commit option
    dhcpClientSettings.rapidCommit = FALSE;

    //DHCP client initialization
    error = dhcpClientInit(&dhcpClientContext, &dhcpClientSettings);
    //Failed to initialize DHCP client?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to initialize DHCP client!\r\n");
    }

    //Start DHCP client
    error = dhcpClientStart(&dhcpClientContext);
    //Failed to start DHCP client?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start DHCP client!\r\n");
    }
#else
    //Set IPv4 host address
    ipv4StringToAddr(APP_IPV4_HOST_ADDR, &ipv4Addr);
    ipv4SetHostAddr(interface, ipv4Addr);

    //Set subnet mask
    ipv4StringToAddr(APP_IPV4_SUBNET_MASK, &ipv4Addr);
    ipv4SetSubnetMask(interface, ipv4Addr);

    //Set default gateway
    ipv4StringToAddr(APP_IPV4_DEFAULT_GATEWAY, &ipv4Addr);
    ipv4SetDefaultGateway(interface, ipv4Addr);

    //Set primary and secondary DNS servers
    ipv4StringToAddr(APP_IPV4_PRIMARY_DNS, &ipv4Addr);
    ipv4SetDnsServer(interface, 0, ipv4Addr);
    ipv4StringToAddr(APP_IPV4_SECONDARY_DNS, &ipv4Addr);
    ipv4SetDnsServer(interface, 1, ipv4Addr);
#endif
#endif

#if (IPV6_SUPPORT == ENABLED)
#if (APP_USE_SLAAC == ENABLED)
    //Get default settings
    slaacGetDefaultSettings(&slaacSettings);
    //Set the network interface to be configured
    slaacSettings.interface = interface;

    //SLAAC initialization
    error = slaacInit(&slaacContext, &slaacSettings);
    //Failed to initialize SLAAC?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to initialize SLAAC!\r\n");
    }

    //Start IPv6 address autoconfiguration process
    error = slaacStart(&slaacContext);
    //Failed to start SLAAC process?
    if(error)
    {
        //Debug message
        TRACE_ERROR("Failed to start SLAAC!\r\n");
    }
#else
    //Set link-local address
    ipv6StringToAddr(APP_IPV6_LINK_LOCAL_ADDR, &ipv6Addr);
    ipv6SetLinkLocalAddr(interface, &ipv6Addr);

    //Set IPv6 prefix
    ipv6StringToAddr(APP_IPV6_PREFIX, &ipv6Addr);
    ipv6SetPrefix(interface, &ipv6Addr, APP_IPV6_PREFIX_LENGTH);

    //Set global address
    ipv6StringToAddr(APP_IPV6_GLOBAL_ADDR, &ipv6Addr);
    ipv6SetGlobalAddr(interface, &ipv6Addr);

    //Set router
    ipv6StringToAddr(APP_IPV6_ROUTER, &ipv6Addr);
    ipv6SetRouter(interface, &ipv6Addr);

    //Set primary and secondary DNS servers
    ipv6StringToAddr(APP_IPV6_PRIMARY_DNS, &ipv6Addr);
    ipv6SetDnsServer(interface, 0, &ipv6Addr);
    ipv6StringToAddr(APP_IPV6_SECONDARY_DNS, &ipv6Addr);
    ipv6SetDnsServer(interface, 1, &ipv6Addr);
#endif
#endif

    //Create user task
    task = osCreateTask("User Task", userTask, NULL, 500, 1);
    //Failed to create the task?
    if(task == OS_INVALID_HANDLE)
    {
        //Debug message
        TRACE_ERROR("Failed to create task!\r\n");
    }

    //Create a task to blink the LED
    task = osCreateTask("Blink", blinkTask, NULL, 500, 1);
    //Failed to create the task?
    if(task == OS_INVALID_HANDLE)
    {
        //Debug message
        TRACE_ERROR("Failed to create task!\r\n");
    }

    //Start the execution of tasks
    osStartKernel();

    //This function should never return
    return 0;
}
/**
 * @brief Interrupt Service Routine Port 1
 */
void isrPort1()
{
	// Process RTCSET Pin
	if(pinDigitalIsPendingInterrupt(RTCSET))
	{
		if(pinDigitalRead(RTCSET) == 0)
		{
			delayMs(10);

			if(pinDigitalRead(RTCSET) == 0)
			{
				digitToModify++;

				// LCD Blink On
				lcdCursorBlinkOn();

				// Write On Configure RTC Indicator
				lcdWriteSetPosition(1,17,'*');

				// Stop RTC
				rtcStop();

				switch(digitToModify)
				{
					case 1:
						lcdSetCursor(2,1);
						break;
					case 2:
						lcdSetCursor(2,4);
						break;
					case 3:
						lcdSetCursor(2,7);
						break;
					case 4:
						lcdSetCursor(2,11);
						break;
					case 5:
						lcdSetCursor(2,14);
						break;
					case 6:
						lcdSetCursor(2,17);
						break;
					default:
						digitToModify = 0;

						// LCD Blink Off
						lcdCursorBlinkOff();

						// Write Off Configure RTC Indicator
						lcdWriteSetPosition(1,17,' ');

						// Start RTC
						rtcStart();

						break;
				}
			}
		}
		// Clear RTCSET Interrupt
		pinDigitalClearPendingInterrupt(RTCSET);
	}

	// Process RTCINC Pin
	if(pinDigitalIsPendingInterrupt(RTCINC))
	{
		if(pinDigitalRead(RTCINC) == 0)
		{
			delayMs(10);

			if(pinDigitalRead(RTCINC) == 0)
			{
				switch(digitToModify)
				{
				case 1:
					rtcSetHour(rtcGetHour() + 1);
					lcdDataDecFormat(rtcGetHour(),2);
					lcdSetCursor(2,1);
					break;
				case 2:
					rtcSetMinute(rtcGetMinute() + 1);
					lcdDataDecFormat(rtcGetMinute(),2);
					lcdSetCursor(2,4);
					break;
				case 3:
					rtcSetSecond(rtcGetSecond() + 1);
					lcdDataDecFormat(rtcGetSecond(),2);
					lcdSetCursor(2,7);
					break;
				case 4:
					rtcSetDay(rtcGetDay() + 1);
					lcdDataDecFormat(rtcGetDay(),2);
					lcdSetCursor(2,11);
					break;
				case 5:
					rtcSetMonth(rtcGetMonth() + 1);
					lcdDataDecFormat(rtcGetMonth(),2);
					lcdSetCursor(2,14);
					break;
				case 6:
					rtcSetYear(rtcGetYear() + 1);
					lcdDataDecFormat(rtcGetYear(),4);
					lcdSetCursor(2,17);
					break;
				default:
					directionPap = 0;
					break;
				}
			}
		}
		// Clear RTCINC Interrupt
		pinDigitalClearPendingInterrupt(RTCINC);
	}

	// Process RTCDEC Pin
	if(pinDigitalIsPendingInterrupt(RTCDEC))
	{
		if(pinDigitalRead(RTCDEC) == 0)
		{
			delayMs(10);

			if(pinDigitalRead(RTCDEC) == 0)
			{
				switch(digitToModify)
				{
				case 1:
					rtcSetHour(rtcGetHour() - 1);
					lcdDataDecFormat(rtcGetHour(),2);
					lcdSetCursor(2,1);
					break;
				case 2:
					rtcSetMinute(rtcGetMinute() - 1);
					lcdDataDecFormat(rtcGetMinute(),2);
					lcdSetCursor(2,4);
					break;
				case 3:
					rtcSetSecond(rtcGetSecond() - 1);
					lcdDataDecFormat(rtcGetSecond(),2);
					lcdSetCursor(2,7);
					break;
				case 4:
					rtcSetDay(rtcGetDay() - 1);
					lcdDataDecFormat(rtcGetDay(),2);
					lcdSetCursor(2,11);
					break;
				case 5:
					rtcSetMonth(rtcGetMonth() - 1);
					lcdDataDecFormat(rtcGetMonth(),2);
					lcdSetCursor(2,14);
					break;
				case 6:
					rtcSetYear(rtcGetYear() - 1);
					lcdDataDecFormat(rtcGetYear(),4);
					lcdSetCursor(2,17);
					break;
				default:
					directionPap = 1;
					break;
				}
			}
		}
		// Clear RTCDEC Interrupt
		pinDigitalClearPendingInterrupt(RTCDEC);
	}
}