#include "AT91SAM7X512.h"
#include "memory.h"

unsigned char def[8],def_outstat[3];
unsigned char *def_password= "heslo";

int reset_switch(void)
{
  AT91C_BASE_PIOA->PIO_PER = (0x1 << 1);
  AT91C_BASE_PIOA->PIO_PPUER = (0x1 << 1);


    if(AT91C_BASE_PIOA->PIO_PDSR & (0x1 << 1))
      {
    break;

      }
    else
      {
       def[0] = 192;
	   def[1] = 168;
	   def[2] = 53;
	   def[3] = 195;
       def[4] = 255;
	   def[5] = 255;
	   def[6] = 255;
	   def[7] = 0;

	   def_outstat[0]=0;
	   def_outstat[1]=0;
	   def_outstat[2]=0;

       at45db_write( 0x00, 0x00, 0x00, def, 8);           // Default IP address ane Mask
       at45db_write( 0x00, 0x10, 0x00, def_password, 5);  // Default password
       at45db_write( 0x00, 0x04, 0x00, def_outstat, 3);   // Default output status

       AT91C_BASE_RSTC->RSTC_RCR  = (0xA5 << 24) | AT91C_RSTC_PROCRST;
        }


  return 0;
}
