int CKMotionIO::SetLatency(UCHAR LatencyTimer) { int ftStatus; unsigned char c; Mutex->Lock(); ftStatus = ftdi_get_latency_timer(ftdi,&c ); if(c != LatencyTimer){ log_info("ftdi_get_latency_timer old value %d", c); ftStatus = ftdi_set_latency_timer(ftdi,LatencyTimer ); if (ftStatus < FT_OK) { // FT_SetLatencyTimer FAILED! ErrorMessageBox("Unable to set USB Latency timer"); Mutex->Unlock(); return 1; } } // LatencyTimer set ftStatus = ftdi_set_event_char(ftdi,'\n',1); if (ftStatus == FT_OK) { // Event set Mutex->Unlock(); return 0; } else { // FT_SetLatencyTimer FAILED! ErrorMessageBox("Unable to set USB Event Character"); Mutex->Unlock(); return 1; } }
int Context::set_event_char(unsigned char eventch, unsigned char enable) { return ftdi_set_event_char(d->ftdi, eventch, enable); }