这篇教程C++ send_stop函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中send_stop函数的典型用法代码示例。如果您正苦于以下问题:C++ send_stop函数的具体用法?C++ send_stop怎么用?C++ send_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了send_stop函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: i2c_read/*----------------------------------------------------------------------- * Read bytes */int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len){ int shift; PRINTD("i2c_read: chip %02X addr %02X alen %d buffer %p len %d/n", chip, addr, alen, buffer, len);#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW /* * EEPROM chips that implement "address overflow" are ones * like Catalyst 24WC04/08/16 which has 9/10/11 bits of * address and the extra bits end up in the "chip address" * bit slots. This makes a 24WC08 (1Kbyte) chip look like * four 256 byte chips. * * Note that we consider the length of the address field to * still be one byte because the extra address bits are * hidden in the chip address. */ chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW); PRINTD("i2c_read: fix addr_overflow: chip %02X addr %02X/n", chip, addr);#endif /* * Do the addressing portion of a write cycle to set the * chip's address pointer. If the address length is zero, * don't do the normal write cycle to set the address pointer, * there is no address pointer in this chip. */ send_start(); if(alen > 0) { if(write_byte(chip << 1)) { /* write cycle */ send_stop(); PRINTD("i2c_read, no chip responded %02X/n", chip); return(1); } shift = (alen-1) * 8; while(alen-- > 0) { if(write_byte(addr >> shift)) { PRINTD("i2c_read, address not <ACK>ed/n"); return(1); } shift -= 8; } send_stop(); /* reportedly some chips need a full stop */ send_start(); } /* * Send the chip address again, this time for a read cycle. * Then read the data. On the last byte, we do a NACK instead * of an ACK(len == 0) to terminate the read. */ write_byte((chip << 1) | 1); /* read cycle */ while(len-- > 0) { *buffer++ = read_byte(len == 0); } send_stop(); return(0);}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:63,
示例2: i2c_write/*----------------------------------------------------------------------- * Write bytes */int i2c_write(uchar chip, uint addr, int alen, const uchar *buffer, int len){ int shift, failures = 0; PRINTD("i2c_write: chip %02X addr %02X alen %d buffer %p len %d/n", chip, addr, alen, buffer, len); send_start(); if(write_byte(chip << 1)) { /* write cycle */ send_stop(); PRINTD("i2c_write, no chip responded %02X/n", chip); return(1); } shift = (alen-1) * 8; while(alen-- > 0) { if(write_byte(addr >> shift)) { PRINTD("i2c_write, address not <ACK>ed/n"); return(1); } shift -= 8; } while(len-- > 0) { if(write_byte(*buffer++)) { failures++; } } send_stop(); return(failures);}
开发者ID:miaofng,项目名称:ulp,代码行数:33,
示例3: fsa9480_i2c_writeint fsa9480_i2c_write(u8 addr, u8 data){ u8 chip = 0x4A; send_start(); if (write_byte(chip << 1)) /* write cycle */ { send_stop();// dprintf(INFO,"i2c_write, no chip responded %02X/n", chip); return(1); } if (write_byte(addr)) {// dprintf(INFO,"i2c_write, address not <ACK>/n"); return(1); } if (write_byte(data)) {// dprintf(INFO,"i2c_write, data not <ACK>/n"); return(1); } send_stop(); return 0; }
开发者ID:Nileshmk,项目名称:LK_BOOT_S8600,代码行数:27,
示例4: i2c_tx_handlervoid i2c_tx_handler(){ //debugNum(1); switch(ic_ptr->status){ case(I2C_STARTED): load_i2c_data(); //start handled same way as sending data - address should already be loaded. break; case(I2C_MASTER_SEND): ic_ptr->nack = SSPCON2bits.ACKSTAT; if((SSPCON2bits.ACKSTAT == 1) || check_if_send_stop()){ //ack not received or it should stop naturally //ic_ptr->outbufind--; //Resend last byte send_stop(); } else{ if(load_i2c_data() == 1) { //WCOL bit set SSPCON1bits.WCOL = 0; send_stop(); } } break; case(I2C_STOPPED): //stop ic_ptr->status = I2C_IDLE; if(!ic_ptr->nack){ if(ic_ptr->read_after_write){ i2c_master_recv(ic_ptr->addr); //send a request for data (either ack or data) } else{#ifdef MASTER_PIC if(colorSensorInitStage <= INT_CLEAR){ FromI2CInt_sendmsg(0, MSGT_COLOR_SENSOR_INIT, (void*) 0); }#endif ic_ptr->read_after_write = 1; //reset to 1 just in case } } else{ char error[6]; if(ic_ptr->addr == SENSOR_ADDR){ //sensor pic generateSensorPICDetectionError(error, sizeof error, UART_COMM); } else{//motor pic generateMotorPICDetectionError(error, sizeof error, UART_COMM); } FromI2CInt_sendmsg(sizeof error, MSGT_I2C_MASTER_SEND_FAILED, error); } break; default: break; }}
开发者ID:Carrotman42,项目名称:cs4534,代码行数:49,
示例5: read_eeprom/* * This function does the actual read of the EEPROM. It needs the buffer into which the * read data is copied, the size of the EEPROM being read and the buffer size */int read_eeprom(char *buffer, int eeprom_size, int size){ int i = 0, err; send_start(); send_byte(W_HEADER); recv_ack(); /* EEPROM with size of more than 2K need two byte addressing */ if (eeprom_size > 2048) { send_byte(0x00); recv_ack(); } send_start(); send_byte(R_HEADER); err = recv_ack(); if (err == -1) return err; for (i = 0; i < size; i++) { *buffer++ = recv_byte(); send_ack(); } /* Note : We should do some check if the buffer contains correct information */ send_stop();}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:33,
示例6: module_cleanupvoid module_cleanup(module_info * mod) { layout *curlay = NULL; char temp[8] = { 0 }; int i = 0; button *btn = NULL; bool ret = false; /*Send command to stop test */ send_stop(mod); if(is_camera_module(mod)) { usleep(500 * 1000); cam_stop_preview(); } pthread_kill(g_module_tid, SIGUSR1); if(strstr(mod->config_list[KEY_PARAMETER].c_str(), "magnetic") != NULL) { curlay = acquire_cur_layout(); for(i = 0; i < ROUND_ANGLE; i++) { snprintf(temp, sizeof(temp), "%d", i); if(curlay != NULL) { ret = curlay->delete_btn_by_name(temp); if(!ret) { ALOGE("Fail to delete button %s", temp); } } } release_cur_layout(); }}
开发者ID:xingrz,项目名称:android_tools_leeco_msm8996,代码行数:31,
示例7: i2c_master_tx_rxint i2c_master_tx_rx(uint8_t addr, uint8_t *tx_data, int tx_len, uint8_t *rx_data, int rx_len){ int i; I2C0_SA = addr; // Set the slave addr I2C0_CNT = tx_len & 0xFF; // Set the tx data count I2C0_CON |= (1 << 9) | (1 << 10); // Set the Master Tx mode if (send_start()) I2C_QUIT_OP; // Trigger by sending Start for (i = 0; i < tx_len; i++) // Send Data { if (send_data(tx_data[i])) I2C_QUIT_OP; } while (!(I2C0_IRQSTATUS & I2C_ST_AR)) // Wait for ready for accessing registers after the tx complete ; I2C0_IRQSTATUS |= I2C_ST_AR; I2C0_CNT = rx_len & 0xFF; // Set the rx data count I2C0_CON &= ~(1 << 9); // Set the Master Rx mode - note master is already set if (send_restart()) I2C_QUIT_OP; // Trigger by sending Start again for (i = 0; i < rx_len; i++) // Receive Data { if (recv_data(&rx_data[i])) I2C_QUIT_OP; } send_stop(); // Done, so Stop return 0;}
开发者ID:litanparida1991,项目名称:bbb,代码行数:26,
示例8: i2c_resetirom i2c_error_t i2c_reset(void){ int current; if(!i2c_flags.init_done) return(i2c_error_no_init); state = i2c_state_stop_send; send_stop(); // if someone is holding the sda line, simulate clock cycles // to make them release it for(current = i2c_config_idle_timeout; current > 0; current--) { if(sda_is_set()) break; clear_scl(); delay(); set_scl(); delay(); } if(!sda_is_set()) return(i2c_error_sda_stuck); if(!scl_is_set()) return(i2c_error_bus_lock); state = i2c_state_idle; return(i2c_error_ok);}
开发者ID:chuanchen0,项目名称:esp8266-universal-io-bridge,代码行数:35,
示例9: send_reset/*----------------------------------------------------------------------- * Send a reset sequence consisting of 9 clocks with the data signal high * to clock any confused device back into an idle state. Also send a * <stop> at the end of the sequence for belts & suspenders. */static void send_reset(void){#ifdef CONFIG_MPC8260 volatile ioport_t *iop = ioport_addr((immap_t *)CFG_IMMR, I2C_PORT);#endif#ifdef CONFIG_8xx volatile immap_t *immr = (immap_t *)CFG_IMMR;#endif int j; I2C_SCL(1); I2C_SDA(1);#ifdef I2C_INIT I2C_INIT;#endif I2C_TRISTATE; for(j = 0; j < 9; j++) { I2C_SCL(0); I2C_DELAY; I2C_DELAY; I2C_SCL(1); I2C_DELAY; I2C_DELAY; } send_stop(); I2C_TRISTATE;}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:32,
示例10: send_stopvoid zmq::socket_base_t::stop (){ // Called by ctx when it is terminated (zmq_term). // 'stop' command is sent from the threads that called zmq_term to // the thread owning the socket. This way, blocking call in the // owner thread can be interrupted. send_stop ();}
开发者ID:BugFreeSoftware,项目名称:Open-Transactions,代码行数:8,
示例11: navigate_pathvoid navigate_path(){ int bool; struct timespec wait; wait.tv_sec = 0; wait.tv_nsec = SLEEP_DURATION; reset_timer(); set_direction(¤t); set_distance(¤t); send_direction(¤t.current_destination.angle); send_distance(¤t.current_destination.distance); while(running == 1){//Infinite loop until it reaches point or collision avoidance occurs. printf("%d/n", current.num); update_position(¤t); send_position(¤t.current_point); if(check(current.current_point, current.current_destination) == 1){ if(check(current.current_point, current.ending_point) == 1){ current.path[current.num] = current.current_destination; current.num++; count++; current.path = realloc(current.path, sizeof(position) * (current.num+1)); if(current.path == NULL){ printf("!!!!!/n"); send_stop(); } send_stop(); bool = 0; free(current.path); free(route.path); break; } else{ current.path[current.num] = current.current_destination; current.num++; count++; printf("%d/n", sizeof(position) * (current.num+1)); current.path = realloc(current.path, sizeof(position) * (current.num+1)); if(current.path == NULL){ printf("!!!!!/n"); send_stop(); } current.current_destination = route.path[count]; bool = 1; break; } }
开发者ID:guswangqi,项目名称:nav,代码行数:45,
示例12: sig_composing_stopstatic voidsig_composing_stop(XMPP_SERVER_REC *server, const char *dest){ DATALIST_REC *rec; g_return_if_fail(IS_XMPP_SERVER(server)); g_return_if_fail(dest != NULL); if ((rec = datalist_find(composings, server, dest)) != NULL) send_stop(server, dest, rec->data);}
开发者ID:markhibberd,项目名称:irssi-xmpp,代码行数:10,
示例13: process_user_packetstaticvoid process_user_packet(tc_user_t *u){ unsigned char frame[MAX_FRAME_LENGTH]; if (send_stop(u)) { return; } while (true) { if (u->orig_frame->frame_len > MAX_FRAME_LENGTH) { tc_log_info(LOG_NOTICE, 0, " frame length may be damaged"); } memcpy(frame, u->orig_frame->frame_data, u->orig_frame->frame_len); process_packet(u, frame); u->total_packets_sent++; u->orig_frame = u->orig_frame->next; if (send_stop(u)) { break; } tc_log_debug1(LOG_DEBUG, 0, "check resp waiting:%u", ntohs(u->src_port)); if (!u->orig_frame->belong_to_the_same_req) { tc_log_debug2(LOG_DEBUG, 0, "user state:%d,port:%u", u->state.status, ntohs(u->src_port)); if (u->state.status & SYN_CONFIRM) { tc_log_debug1(LOG_DEBUG, 0, "set resp waiting:%u", ntohs(u->src_port)); u->state.resp_waiting = 1; } break; } else { tc_log_debug1(LOG_DEBUG, 0, "the same req:%u", ntohs(u->src_port)); } }}
开发者ID:chu888chu888,项目名称:Linux-gryphon,代码行数:39,
示例14: i2c_probe/*----------------------------------------------------------------------- * Probe to see if a chip is present. Also good for checking for the * completion of EEPROM writes since the chip stops responding until * the write completes (typically 10mSec). */int i2c_probe(uchar addr){ int rc; /* * perform 1 byte write transaction with just address byte * (fake write) */ send_start(); rc = write_byte ((addr << 1) | 0); send_stop(); return (rc ? 1 : 0);}
开发者ID:miaofng,项目名称:ulp,代码行数:19,
示例15: compare_tilevoid compare_tile(){ if((int)(current.current_point.lon) != (int)(current.path[current.num-1].lon) || (int)(current.current_point.lat) != (int)(current.path[current.num-1].lat)) { current.path[current.num] = current.current_point; current.path[current.num].angle = current.current_destination.angle; current.num++; current.path = realloc(current.path, sizeof(position) * (current.num+1)); if(current.path == NULL){ printf("!!!!!/n"); send_stop(); } }}
开发者ID:guswangqi,项目名称:nav,代码行数:15,
示例16: i2c_master_txint i2c_master_tx(uint8_t addr, uint8_t *data, int len){ int i; I2C0_SA = addr; // Set the slave addr I2C0_CNT = len & 0xFF; // Set the data count I2C0_CON |= (1 << 9) | (1 << 10); // Set the Master Tx mode if (send_start()) I2C_QUIT_OP; // Trigger by sending Start for (i = 0; i < len; i++) { if (send_data(data[i])) I2C_QUIT_OP; } send_stop(); // Done, so Stop return 0;}
开发者ID:litanparida1991,项目名称:bbb,代码行数:16,
示例17: i2c_sendirom i2c_error_t i2c_send(int address, int length, const uint8_t *bytes){ int current; i2c_error_t error; bool_t ack; if(!i2c_flags.init_done) return(i2c_error_no_init); if(state != i2c_state_idle) return(i2c_error_invalid_state_not_idle); state = i2c_state_header_send; if((error = send_header(address, i2c_direction_send)) != i2c_error_ok) return(error); for(current = 0; current < length; current++) { state = i2c_state_data_send_data; if((error = send_byte(bytes[current])) != i2c_error_ok) return(error); state = i2c_state_data_send_ack_receive; if((error = receive_ack(&ack)) != i2c_error_ok) return(error); state = i2c_state_data_send_ack_received; if(!ack) return(i2c_error_data_nak); } state = i2c_state_stop_send; if((error = send_stop()) != i2c_error_ok) return(error); state = i2c_state_idle; return(i2c_error_ok);}
开发者ID:chuanchen0,项目名称:esp8266-universal-io-bridge,代码行数:44,
示例18: DBG_ENTRY_LVLSendControlStatusDataLink::send_control(const DataSampleHeader& header, ACE_Message_Block* message){ DBG_ENTRY_LVL("DataLink", "send_control", 6); TransportSendControlElement* const elem = TransportSendControlElement::alloc(1, // initial_count GUID_UNKNOWN, &send_response_listener_, header, message, send_control_allocator_); if (!elem) return SEND_CONTROL_ERROR; send_response_listener_.track_message(); RepoId senderId(header.publication_id_); send_start(); send(elem); send_stop(senderId); return SEND_CONTROL_OK;}
开发者ID:tempbottle,项目名称:OpenDDS,代码行数:20,
示例19: send_reset/*----------------------------------------------------------------------- * Send a reset sequence consisting of 9 clocks with the data signal high * to clock any confused device back into an idle state. Also send a * <stop> at the end of the sequence for belts & suspenders. */static void send_reset(void){ int j; I2C_SCL(1); I2C_SDA(1);#ifdef I2C_INIT I2C_INIT;#endif I2C_TRISTATE; for(j = 0; j < 9; j++) { I2C_SCL(0); I2C_DELAY; I2C_DELAY; I2C_SCL(1); I2C_DELAY; I2C_DELAY; } send_stop(); I2C_TRISTATE;}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:26,
示例20: send_reset/*----------------------------------------------------------------------- * Send a reset sequence consisting of 9 clocks with the data signal high * to clock any confused device back into an idle state. Also send a * <stop> at the end of the sequence for belts & suspenders. */static void send_reset(void){ I2C_SOFT_DECLARATIONS /* intentional without ';' */ int j;#ifdef I2C_INIT I2C_INIT;#endif I2C_SCL(1); I2C_SDA(1); I2C_TRISTATE; for(j = 0; j < 9; j++) { I2C_SCL(0); I2C_DELAY; I2C_DELAY; I2C_SCL(1); I2C_DELAY; I2C_DELAY; } send_stop(); I2C_TRISTATE;}
开发者ID:miaofng,项目名称:ulp,代码行数:27,
示例21: i2c_receiveirom i2c_error_t i2c_receive(int address, int length, uint8_t *bytes){ int current; i2c_error_t error; if(!i2c_flags.init_done) return(i2c_error_no_init); if(state != i2c_state_idle) return(i2c_error_invalid_state_not_idle); state = i2c_state_header_send; if((error = send_header(address, i2c_direction_receive)) != i2c_error_ok) return(error); for(current = 0; current < length; current++) { state = i2c_state_data_receive_data; if((error = receive_byte(&bytes[current])) != i2c_error_ok) return(error); state = i2c_state_data_receive_ack_send; if((error = send_ack((current + 1) < length)) != i2c_error_ok) return(error); } state = i2c_state_stop_send; if((error = send_stop()) != i2c_error_ok) return(error); state = i2c_state_idle; return(i2c_error_ok);}
开发者ID:chuanchen0,项目名称:esp8266-universal-io-bridge,代码行数:38,
示例22: send_stopvoid zmq::io_thread_t::stop (){ send_stop ();}
开发者ID:Artesian,项目名称:libzmq,代码行数:4,
示例23: send_stopvoid zmq::reaper_t::stop (){ send_stop ();}
开发者ID:aubonbeurre,项目名称:libzmq,代码行数:4,
示例24: i2c_rx_handlervoid i2c_rx_handler(){ //debugNum(2); switch(ic_ptr->status){ case(I2C_STARTED):{ int i = 0; for(i; i < 100; i++);//need something to stall or everything falls to shit. //no idea what's going wrong but this has worked without incident ic_ptr->checksum_failed = 0; load_i2c_data(); break; }; case(I2C_MASTER_SEND): //sent the addr ic_ptr->nack = SSPCON2bits.ACKSTAT; if(SSPCON2bits.ACKSTAT == 1){ //ack not received send_stop(); } else{ ic_ptr->status = I2C_RCV_DATA; SSPCON2bits.RCEN = 1; } break; case(I2C_RCV_DATA): if(receive_data() == 1){ //receive is finished ic_ptr->status = I2C_NACK; } break; case(I2C_ACK): ic_ptr->status = I2C_RCV_DATA; SSPCON2bits.RCEN = 1; break; case(I2C_NACK): send_stop(); break; case(I2C_STOPPED): ic_ptr->status = I2C_IDLE; ic_ptr->checksum = 0; if(!ic_ptr->nack){ if(!ic_ptr->checksum_failed){ if(isHighPriority(ic_ptr->buffer)){ setRoverDataHP(ic_ptr->buffer); handleRoverDataHP(); } else{ FromI2CInt_sendmsg(ic_ptr->buflen, MSGT_I2C_DATA, ic_ptr->buffer); } } else{ char error[6] = {0}; generateChecksumError(error, sizeof error, UART_COMM); //the intention is that this may be sent over uart //but will not be sent over i2c FromI2CInt_sendmsg(sizeof error, MSGT_I2C_MASTER_RECV_FAILED, (void *) error); } } else{ char error[6] = {0}; if(ic_ptr->addr == SENSOR_ADDR){ //sensor pic generateSensorPICDetectionError(error, sizeof error, UART_COMM); } else{//motor pic generateMotorPICDetectionError(error, sizeof error, UART_COMM); } FromI2CInt_sendmsg(sizeof error, MSGT_I2C_MASTER_RECV_FAILED, (void *) error); } break; default: break; } //debugNum(4);}
开发者ID:Carrotman42,项目名称:cs4534,代码行数:69,
注:本文中的send_stop函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ send_string函数代码示例 C++ send_status函数代码示例 |