コード例 #1
0
void SubtitleCorrector::SetCorrections(std::vector<std::string> times, std::vector<int> shifts)
{
	for (int i = 0; i < times.size(); i++)
	{
		corrections[GetMillis(times[i])] = shifts[i];
	}
}
コード例 #2
0
static void WaitForReleaseAxis(int js_fd, int channel, int *zero) {
    int zero_value = 1 << 17;
    struct js_event e;
    for (;;) {
        if (JoystickWaitForEvent(js_fd, &e, 1000) <= 0)
            continue;
        if (e.type == JS_EVENT_AXIS && e.number == channel
            && abs(e.value) < 5000) {
            zero_value = e.value;
            break;
        }
    }
    // Now, we read the values while they come in, assuming the last one
    // is the 'zero' position.
    const int64_t end_time = GetMillis() + 100;
    while (GetMillis() < end_time) {
        if (JoystickWaitForEvent(js_fd, &e, 100) <= 0)
            continue;
        if (e.type == JS_EVENT_AXIS && e.number == channel) {
            zero_value = e.value;
        }
    }
    *zero = zero_value;
}
コード例 #3
0
ファイル: MainFile.c プロジェクト: atifshabir/SergeysWork
int main(int argc, char *argv[])
{
	///// Code for getting options starts here /////
	int optChar;

	strcpy(configFileName, DEFAULT_CONFIG_FILE_NAME);

	sprintf(buildTimeInfo,"Build time is %s %s",__DATE__, __TIME__);
	printf("\n%s\n",buildTimeInfo);
	fflush(stdout);

	while((optChar = getopt(argc, argv, "c:h")) != -1)
	{
		switch(optChar)
		{
		case 'c':
			strcpy(configFileName, optarg);
			break;

		case 'h':
			PrintHelp(argv[0]);
			exit(0);
		}
	}

	///// Code for getting optins ends here //////
	ReadConfigurationParams();
	OpenLogFile();
	fprintf(logFile, "\n=====================");
	fprintf(logFile, "\n%u; Demon started", GetMillis());
	fflush(logFile);
	TCPComm_Start();

	return 0;

	/*
	OpenI2C("dummy");
	EepromWriteEnable();

	DeviceAddress(ADDR_EEPROM);
	tempAddr[0] = 0xC0;
	tempAddr[1] = 0x01;
	tempRead[0] = 0X55;

	TxToDevice(tempRead,1,tempAddr,2);
	tempRead[0] = 0x22;
	RxToDevice(tempAddr,2, tempRead, 1);
	printf("\nValue Read  %X",(unsigned char)(tempRead[0]));
	fflush(stdout);


	SendValToMultiportReg(0x01, 0x08); //endable port output first

	SendValToMultiportReg(0x00, 0x18); //select port 0 for config

	SendValToMultiportReg(0x01, 0x1A); //select port 0 ping 0 as pwm out

	SendValToMultiportReg(0x07, 0x28); //selecte pwm no 7.

	SendValToMultiportReg(0x04, 0x29); //programmable clk source

	SendValToMultiportReg(0x04, 0x2A); //set period

	SendValToMultiportReg(0x03, 0x2B); //pulse widdth = 3/4. Duty cycle = 75%
*/



}
コード例 #4
0
ファイル: device.cpp プロジェクト: mallardtheduck/osdev
uint64_t get_msecs(){
	auto timer = get_timer();
	if(!timer) return 0;
	else return timer->GetMillis();
}