Ejemplo n.º 1
0
int main()
{
  printf("System Restarted!!!\n");
  //unsigned char mydata[8];

  //strcpy(fifo,"######");

  Uart_init();//Register RS232_RXD
  wifi_init();//initialize the wifi module


  while(1)
  {
	  //led_init();
	 test_key();
	 test_alarm();
	 test_alarm_en();
	  welcome();
	  Alarm();
	  //printf("%X\n",ringbell);
	  //printf("%x",IORD_ALTERA_AVALON_PIO_DATA(MYINPUT_BASE));

	  Uart_send_n("AT",2);
	  Uart_send(0x0d);
	  Uart_send(0x0a);

	  usleep(2000000);//2s
  }
  return 0;
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
	int fd;

	parse_args(argc, argv);
	print_options();

	fd = open(rtcdev, O_RDONLY);

	if (fd == -1) {
		perror(rtcdev);
		exit(errno);
	}

	if (autotest) {
		auto_test(fd);
		goto done;
	}

	if (!strcmp(cmd, "read")) {
		test_read_time(fd);
	} else if (!strcmp(cmd, "write")) {
		test_set_time(fd);
	} else if (!strcmp(cmd, "vl")) {
		test_low_voltage(fd);
	} else if (!strcmp(cmd, "update")) {
		test_update(fd);
	} else if (!strcmp(cmd, "alarm")) {
		test_alarm(fd);
	} else if (!strcmp(cmd, "periodic")) {
		test_periodic(fd);
	} else {
		printf("invalid command %s\n", cmd);
	}
	goto done;

done:
	fprintf(stderr, "\n*** Test complete ***\n");

	close(fd);

	return 0;
}