示例#1
0
文件: wiringX.c 项目: n8ohu/wiringX
int wiringXSetup(void) {
	if(setup == -2) {
		hummingboardInit();
		raspberrypiInit();
		bananapiInit();
		radxaInit();

		int match = 0;
		struct devices_t *tmp = devices;
		while(tmp) {
			if(tmp->identify() >= 0) {
				device = tmp;
				match = 1;
				break;
			}
			tmp = tmp->next;
		}

		if(match == 0) {
			fprintf(stderr, "wiringX: hardware not supported\n");
			wiringXGC();
			return -1;
		}
		printf("running on a %s\n", device->name);
		setup = device->setup();
		return setup;
	} else {
		return setup;
	}
}
示例#2
0
文件: wiringX.c 项目: bkrepo/wiringX
int wiringXSetup(void) {
#ifndef _WIN32	
	if(wiringXLog == NULL) {
		wiringXLog = _fprintf;
	}

	if(wiringXSupported() == 0) {
		if(setup == -2) {
			hummingboardInit();
			raspberrypiInit();
			bananapiInit();
			ci20Init();
			radxaInit();
			odroidInit();

			int match = 0;
			struct platform_t *tmp = platforms;
			while(tmp) {
				if(tmp->identify() >= 0) {
					platform = tmp;
					match = 1;
					break;
				}
				tmp = tmp->next;
			}

			if(match == 0) {
				wiringXLog(LOG_ERR, "hardware not supported");
				wiringXGC();
				return -1;
			} else {
				wiringXLog(LOG_DEBUG, "running on a %s", platform->name);
			}
			setup = platform->setup();
			return setup;
		} else {
			return setup;
		}
	}
#endif
	return -1;
}