예제 #1
0
static int stk500generic_open(PROGRAMMER * pgm, char * port)
{
  stk500_initpgm(pgm);
  if (pgm->open(pgm, port) >= 0)
    {
      fprintf(stderr,
	      "%s: successfully opened stk500v1 device -- please use -c stk500v1\n",
	      progname);
      return 0;
    }

  pgm->close(pgm);

  stk500v2_initpgm(pgm);
  if (pgm->open(pgm, port) >= 0)
    {
      fprintf(stderr,
	      "%s: successfully opened stk500v2 device -- please use -c stk500v2\n",
	      progname);
      return 0;
    }

  fprintf(stderr,
	  "%s: cannot open either stk500v1 or stk500v2 programmer\n",
	  progname);
  return -1;
}
예제 #2
0
파일: arduino.c 프로젝트: pilight/pilight
void arduino_initpgm(PROGRAMMER * pgm) {
	/* This is mostly a STK500; just the signature is read
		differently than on real STK500v1
		and the DTR signal is set when opening the serial port
		for the Auto-Reset feature */
	stk500_initpgm(pgm);

	strcpy(pgm->type, "Arduino");
  pgm->read_sig_bytes = arduino_read_sig_bytes;
	pgm->open = arduino_open;
	pgm->close = arduino_close;
}