void Write_Data(unsigned char Data) { txbuf[0] = 0x40; txbuf[1] = Data; send(2); while(busy()); //for(int i = 0; i < 0xFFF; i++); //see above }
void StepMotor::step( StepInfo sInfo ) { if ( !busy() ) { stepInfo = sInfo; mode = MODE_READY; } }
void Write_Command(unsigned char Data) { txbuf[0] = 0x00; txbuf[1] = Data; send(2); //for(int i = 0; i < 0xFFF; i++); //give it 4us before sending next char while(busy()); }
void A110x2500Radio::end() { // Wait until all operations complete. while (busy()); detachInterrupt(RF_GDO0); pinMode (RF_SPI_CSN, INPUT); }
void Write_Data(unsigned char *Data, unsigned char len) //overload this to use DMA transfers? { txbuf[0] = 0x40; memcpy((u8 *)txbuf+1, Data, len); send(len+1); while(busy()); //for(int i = 0; i < 0xFFF; i++); //see above }
void writedata(unsigned char b) // send data to LCD { busy(); // check busy flag rs = 1; // select data register rw = 0; // write enable P0 = b; // write enable en = 1; // send byte to LCD en = 0; // apply strobe pulse }
void writecmd(unsigned char a) // send command to LCD { busy(); // check busy flag rs = 0; // select command register rw = 0; // write enable P0 = a; // send byte to LCD en = 1; // apply strobe pulse en = 0; }
void Speaker::run( unsigned int newFreq, unsigned int newDuration ) { if ( !busy() ) { freq = newFreq; duration = newDuration; mode = MODE_SWITCH; } }
Dialogs::GameDatabaseDialog::GameDatabaseDialog(wxWindow* parent) : BaseConfigurationDialog( parent, AddAppName(_("Game Database - %s")), 580 ) { ScopedBusyCursor busy( Cursor_ReallyBusy ); *this += new Panels::GameDatabasePanel(this); AddOkCancel(); }
void HttpManager::FreeMemory() { for (auto it = clients_.cbegin(); it != clients_.cend(); ) { if (!it->busy()) { clients_.erase(it++); } else { ++it; } } }
void CGE2Engine::resetGame() { _busyPtr = nullptr; busy(false); _spare->clear(); _vga->_showQ->clear(); loadScript("CGE.INI", true); delete _infoLine; _infoLine = new InfoLine(this, kInfoW); }
void Runner::stop() { if (!busy()) MovingObject::stop(); for (std::list<Block*>::iterator bit = field->blocks.begin(); bit != field->blocks.end(); bit++ ) if (!(*bit)->falling) (*bit)->stop(); postVX = 0; }
void import_tree( void ) { FILE *fp ; short transfer_type = FAMTREE_TYPE ; short succeed ; /* primarily used to check if gedcom header loaded */ if( get_transfer_file_name( transfer_type ) && ( fp = fopen( transfer_file, "r" ) ) ) { busy( BUSY_MORE ) ; transfer_type = read_trans_hdr_type( fp ) ; switch( transfer_type ) { case FAMTREE_TYPE : load_std_trans_hdr( fp ) ; if( check_hdr() ) { trans_pers_oset = next_person - 1 ; trans_coup_oset = next_couple - 1 ; load_trans_people( fp ) ; load_trans_couples( fp ) ; } break ; case GEDCOM_TYPE : succeed = prescan_gedcom_file( fp ) ; if( succeed ) load_gedcom_file( fp ) ; break ; case CSV_TYPE : /* Only load csv data if new tree or user chooses to continue */ if( next_person == 1 || rsrc_form_alert( 1, CSV_WARNING ) == 2 ) { fseek( fp, 0, SEEK_SET ) ; /* no header, so return to start of file */ load_csv_file( fp ) ; } break ; } fclose( fp ) ; busy( BUSY_LESS ) ; } }
void PlanExecutor::startBackupSaveJob() { if(busy() || !destinationAvailable()) { return; } discardUserQuestion(); mState = BACKUP_RUNNING; emit stateChanged(); startSleepInhibit(); startBackup(); }
void Lift::addHuman(Human* human) { // qDebug() << "Passengers in lift (count): " << passengers.size(); if (passengers.size() < capacity()) { passengers.push_back(human); } else { busy(true); elevate(); } }
// Thread 함수 DWORD WINAPI ThreadFnc( LPVOID p ) { while(1) { puts( (char*)p ); busy(); } return 0; }
int main(int argc, char **argv) { struct timeval start, end; busy(10); // 建议先运行一次 gettimeofday(&start, NULL); // do something busy(100); // busy(100); // busy(100); // busy(100); // ideal(100); gettimeofday(&end, NULL); printf("escaped %dms.\n", (end.tv_sec - start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000); return 0; }
//*************дÊý¾Ý************************** void write_dat(unsigned char dat) { e=0; NOP; rs=H; NOP; rw=L; NOP; P1=dat; NOP; e=1; NOP; e=0; NOP; busy(); }
void Parser::loadMoreResults() { if(m_ReqType == 0) { if(m_morePossible && m_iOffset < 1000) { Q_EMIT busy(); m_iOffset += 100; QString sRequest = QString("al=1&c[q]="+m_lastSearch+"&c[section]=audio"); m_nRequest.setUrl(QUrl(QString("http://vk.com/al_search.php?"+sRequest))); //c[q]=%0&c[section]=audio&offset=%1").arg(m_lastSearch).arg(m_iOffset))); m_nRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); m_nManager->disconnect(); connect(m_nManager, SIGNAL(finished(QNetworkReply*)), SLOT(searchReply(QNetworkReply*))); { QByteArray t; QString s=QString(sRequest)+"&offset="+QString::number(m_iOffset); t.insert(0, s.toUtf8()); m_nManager->post(m_nRequest, t); } } else { m_morePossible = false; Q_EMIT free(); } } else if(m_ReqType == 2) { if(m_iOffset < 350) { Q_EMIT busy(); m_morePossible = true; m_iOffset += 50; QNetworkRequest request = QNetworkRequest(QUrl("http://vk.com/audio?act=get_recommendations&al=1&id="+m_Auth->vkId()+"&offset="+QString::number(m_iOffset))); m_nManager->disconnect(); connect(m_nManager, SIGNAL(finished(QNetworkReply*)), SLOT(suggestionsReply(QNetworkReply*))); m_nManager->get(request); } else { m_morePossible = false; Q_EMIT free(); } } }
//**************дÃüÁî************************* void write_cmd(unsigned char cmd) { e=0; NOP; rs=L; NOP; rw=L; NOP; P1=cmd; NOP; e=1; NOP; e=0; NOP; busy(); }
queue_file* queue_manager::scan_next() { if (m_scanDir == NULL) logger_fatal("call scan_open first!"); queue_file* fp = NULL; string filePath; while (1) { // 扫描下一个磁盘文件 const char* fileName = acl_scan_dir_next_file(m_scanDir); if (fileName == NULL) return NULL; string partName, extName; if (parse_fileName(fileName, &partName, &extName) == false) continue; // 如果该队列文件已经存在于内存队列中则跳过 if (busy(partName.c_str())) continue; const char* path = acl_scan_dir_path(m_scanDir); if (path == NULL) { logger_error("acl_scan_dir_path error for %s", fileName); continue; } filePath.clear(); filePath << path << PATH_SEP << fileName; fp = NEW queue_file; // 从磁盘打开已经存在的队列文件 if (fp->open(filePath.c_str()) == false) { logger_error("open %s error(%s)", filePath.c_str(), acl_last_serror()); delete fp; fp = NULL; continue; } if (cache_add(fp) == false) { logger_error("file(%s) locked", filePath.c_str()); delete fp; fp = NULL; continue; } else break; } return fp; }
void edit_couple( int reference, int male_ref, int female_ref ) { int partner ; /* member of couple who is not edit */ /* person */ if( reference >= c_index_size ) /* if index full abort after giving */ /* a warning */ { rsrc_form_alert( 1, C_INDEX_FULL ) ; return ; } busy( BUSY_MORE ) ; save_current_edits() ; coup_form.fm_ptr[C_SLIDER].ob_y = 0 ; /* set slider height & offset. */ coup_form.fm_ptr[C_SLIDER].ob_height = coup_form.fm_ptr[C_SLIDERANGE].ob_height / 4 ; edit_coup_ref = reference ; male = couples[reference].male_reference ; female = couples[reference].female_reference ; edit_coup_cptr = load_couple( edit_coup_ref, male_ref, female_ref, &edit_coup_block ) ; if( edit_pers_ref == male ) partner = female ; else partner = male ; form_wind_title( edit_pers_ref, partner, &coup_form, COUPLE_TITLE, COUPLE_ITITLE ) ; coup_form.icon_object = COUP_ICON ; /* If people set up do not allow them to be changed. */ if( male ) coup_form.fm_ptr[MALE].ob_flags &= ~TOUCHEXIT ; else coup_form.fm_ptr[MALE].ob_flags |= TOUCHEXIT ; if( female ) coup_form.fm_ptr[FEMALE].ob_flags &= ~TOUCHEXIT ; else coup_form.fm_ptr[FEMALE].ob_flags |= TOUCHEXIT ; wind_form_do( &coup_form, W_DATE ) ; busy( BUSY_LESS ) ; }
void AppWindow::open_new_file( Glib::ustring string_filename ) { busy(true); char * filename = new char[string_filename.length() + 1 ]; strcpy ( filename , string_filename.c_str() ); #ifdef DEBUG std::cout << "OPEN_NEW_FILE: AppWindow opens " << filename << std::endl; #endif // DEBUG // this is a neat trick to use our argv reader internally, we will never drag more // than one URI (folder or file)! char *arguments[] = { "empty", filename }; ImageManager.OpenNewSet(2, arguments); #ifdef DEBUG std::cout << "OPEN_NEW_FILE(AppWindow): Deleting the allocated memory for temporary filename.\n"; #endif delete[] filename; // set the title, load the image set_title( "gimmage: " + ImageManager.get_current_file() ); ImageBox.LoadImage( ImageManager.get_current_file(), &scalefactor, (int)h_scroller->get_page_size(), (int)v_scroller->get_page_size()); // finally, set the filechooser to the right dirname set_filechooser_dir(); // and make the iconview load the new thumbnails Thumbnails.load_new_thumbs( ImageManager.get_file_list() ); // activate the buttons set_buttons_active( ImageBox.is_loaded() ); busy(false); // since we now have a new image, let's make sure the save button is off! Button_Save.set_sensitive( false ); }
void ArchiveDlg::collectionSelected() { if(lw_conversations->selectedItems().isEmpty()) return; if(lw_conversations->selectedItems().isEmpty()) return; QListWidgetItem *item = (*lw_conversations->selectedItems().begin()); if(item) { if(gct_ == NULL) { gct_ = new GetCollectionTask(pa_->client()->rootTask()); connect(gct_, SIGNAL(busy()), this, SLOT(busy())); connect(gct_, SIGNAL(done(int)), this, SLOT(collectionRetrieved(int))); connect(gct_, SIGNAL(msg(int, bool, const QString&)), this, SLOT(collectionMsg(int, bool, const QString&))); } tw_log->clear(); last_ = QDateTime::fromString(item->data(Qt::UserRole).toString().left(15), Qt::ISODate); gct_->get(jid_, item->data(Qt::UserRole).toString(), 0, max); }
void A110x2500Radio::end() { // Wait until all operations complete. while (busy()); detachInterrupt(RF_GDO0); #if defined( __LM4F120H5QR__) || __TM4C1233H6PM__ ) SPI.end(); #endif pinMode (RF_SPI_CSN, INPUT); }
void fork_and_run() { pid_t pid = fork(); if(pid < 0) errquit("fork() fail"); else if(pid == 0) { busy(); exit(0); } return; }
static int isp_pipeline_wait(struct isp_device *isp, int(*busy)(struct isp_device *isp)) { unsigned long timeout = jiffies + ISP_STOP_TIMEOUT; while (!time_after(jiffies, timeout)) { if (!busy(isp)) return 0; } return 1; }
void CandyController::check_clock(){ // if idle, set up next node poll, if one is due if ( !busy() ){ for (byte node_idx=0; node_idx<_node_count; node_idx++) { if ( _nodes[node_idx].next_poll <= millis() ){ debug("CC: node time!"); begin_node_poll(_nodes[node_idx].node_id); break; }; }; } }
void Parser::library(QString id, QString gid) { m_ReqType = 1; QNetworkRequest request = QNetworkRequest(QUrl(QString("http://vk.com/audio?act=load_audios_silent&al=1&edit=0&gid=%1&id=%0").arg(id).arg(gid))); m_nManager->disconnect(); connect(m_nManager, SIGNAL(finished(QNetworkReply*)), SLOT(libraryReply(QNetworkReply*))); m_nManager->get(request); Q_EMIT busy(); }
void PlanExecutor::startRepairJob() { if(mPlan->mBackupType != BackupPlan::BupType || busy() || !destinationAvailable()) { return; } KJob *lJob = new BupRepairJob(*mPlan, mDestinationPath, mLogFilePath, mKupDaemon); connect(lJob, SIGNAL(result(KJob*)), SLOT(repairFinished(KJob*))); lJob->start(); mLastState = mState; mState = REPAIRING; emit stateChanged(); startSleepInhibit(); }