这篇教程C++ write_command函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中write_command函数的典型用法代码示例。如果您正苦于以下问题:C++ write_command函数的具体用法?C++ write_command怎么用?C++ write_command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了write_command函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _draw_charinline static void _draw_char(int c, uint32_t x, uint32_t y, uint16_t fore, uint16_t back) { uint32_t i, j; uint8_t line; unsigned char *p = (unsigned char *) cp437_font + (c * (int) FONT_CHAR_H); uint16_t buffer[FONT_CHAR_H * FONT_CHAR_W]; uint16_t *q = buffer; for (i = 0; i < FONT_CHAR_H; i++) { line = (uint8_t) *p++; for (j = 0; j < FONT_CHAR_W; j++) { if ((line & 0x1) != 0) { *q = __builtin_bswap16(fore); } else { *q = __builtin_bswap16(back); } line >>= 1; q++; } } write_command(0x2A); write_data_word(x); write_data_word(x + FONT_CHAR_H - 1); write_command(0x2B); write_data_word(y); write_data_word(y + FONT_CHAR_W - 1); write_command(0x2C); bcm2835_spi_writenb((char *) buffer, 2 * FONT_CHAR_H * FONT_CHAR_W);}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:31,
示例2: Display_Clear_Rectvoid Display_Clear_Rect(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int co){ int i, j; write_command(0x2a); write_data(x>>8&0xff);write_data(x&0xff); x += w -1; write_data(x>>8&0xff);write_data(x&0xff); write_command(0x2b); write_data((y)>>8&0xff);write_data((y)&0xff); y += h - 1; write_data((y)>>8&0xff);write_data((y)&0xff); write_command(0x2C); for (j=0; j<h; j++) { for (i=0; i<w; i++) { LCD_DataWrite(co>>8&0xff, co&0xff); } }#if 0 write_command(0x2a); write_data(0);write_data(0); write_data(W>>8&0xff);write_data(W&0xff); write_command(0x2b); write_data(0);write_data(0); write_data(H>>8&0XFF);write_data(H);#endif}
开发者ID:Blade87,项目名称:contiki-stm32f10x-iar,代码行数:28,
示例3: LCD_ExitSleep_ILI9340Cvoid LCD_ExitSleep_ILI9340C(void){ write_command(0x11);//Exit Sleep delay(120); write_command(0x29);//Display on write_command(0x2C);}
开发者ID:MatiasFerraro,项目名称:CIAA-MatiasFerraro,代码行数:7,
示例4: mainvoid main(){ init_lcd(); clear_screen(); choose_screen(1); write_command(x|0); write_command(y|0); write_data(0x01<<0); while(1);}
开发者ID:pikipity,项目名称:snake_8051,代码行数:9,
示例5: addsetvoid addset(unsigned int x,unsigned int y){ write_command(ILI9341_CASET); // Column addr set wr_com16(x>>8,x); write_command(ILI9341_PASET); // Row addr set wr_com16(y>>8,y); write_command(ILI9341_RAMWR); // write to RAM}
开发者ID:MatiasFerraro,项目名称:CIAA-MatiasFerraro,代码行数:9,
示例6: Address_set void Address_set (unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2) { write_command (0x2a); // x -axis write_data (x1); write_data (x2); write_command(0x2b); // y -axis write_data (y1); write_data (y2); write_command(0x2c); }
开发者ID:MatiasFerraro,项目名称:CIAA-MatiasFerraro,代码行数:10,
示例7: clear_screenvoid clear_screen(){ unsigned char x,y; choose_screen(0); for(x=0xb8;x<0xc0;x++){ write_command(x); write_command(0x40); for(y=0;y<64;y++){ write_data(0); } }}
开发者ID:pikipity,项目名称:snake_8051,代码行数:11,
示例8: ili9340_clearvoid ili9340_clear(void) { write_command(0x2A); write_data_word(0); write_data_word(239); write_command(0x2B); write_data_word(0); write_data_word(319); write_command(0x2C); bcm2835_spi_writenb((char *) buffer, 2 * ILI9340_HEIGHT * ILI9340_WIDTH);}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:11,
示例9: hokuyo_initint hokuyo_init(HokuyoLaser* hokuyoLaser){ if (hokuyoLaser->fd<=0){ return -1; }#ifdef HOKUYO_ALWAYS_IN_SCIP20 fprintf(stderr, "/nAssuming laser is already in SCIP2.0 mode!/n"); fprintf(stderr, " (if the dirver hangs, either your Hokuyo has the old/n"); fprintf(stderr, " firmware or you have to disable -DHOKUYO_ALWAYS_IN_SCIP20/n"); fprintf(stderr, " in the Makefile of the laser driver)/n"); hokuyoLaser->isContinuous=0; hokuyoLaser->isProtocol2=1;#else // stop the device anyhow fprintf(stderr, "Stopping the device... "); write_command(hokuyoLaser,HK_QUIT); write_command(hokuyoLaser,HK_QUIT); write_command(hokuyoLaser,HK_QUIT); fprintf(stderr, "done/n"); hokuyoLaser->isContinuous=0; // The UTM-30LX functions only in SCIP2.0 Mode, as do some URG's fprintf(stderr, "Switching to enhanced mode (SCIP2.0)... "); fprintf(stderr, " (if the dirver hangs you probably configured your Hokuyo/n"); fprintf(stderr, " so that SCIP is alwas on. IN this case, enable the Option/n"); fprintf(stderr, " CFLAGS += -DHOKUYO_ALWAYS_IN_SCIP20/n"); fprintf(stderr, " in the Makefile of the laser driver)/n"); int status=hokuyo_readStatus(hokuyoLaser, HK_SCIP,1); if (status==0){ fprintf(stderr, "/nSwitching to SCIP 2.0 was successful!/n"); hokuyoLaser->isProtocol2=1; } else { fprintf(stderr, "Error. Unable to switch to SCIP2.0 Mode, please upgrade the firmware of your device./n"); return -1; }#endif fprintf(stderr, "Device initialized successfully/n"); hokuyoLaser->isInitialized=1; hokuyo_readStatus(hokuyoLaser, "/nVV/n", 1); hokuyo_readStatus(hokuyoLaser, "/nPP/n", 1); hokuyo_readStatus(hokuyoLaser, "/nII/n", 1); return 1;}
开发者ID:acekiller,项目名称:MasterThesis,代码行数:52,
示例10: Display_Clearvoid Display_Clear(unsigned int co){ unsigned char i,j; write_command(0x2a); write_data(0x00);write_data(0x00); write_command(0x2b); write_data(0x00);write_data(0x00); write_command(0x2C); for (i=0;i<H;i++) for (j=0;j<W;j++) LCD_DataWrite(co>>8&0xff, co&0xff);}
开发者ID:Blade87,项目名称:contiki-stm32f10x-iar,代码行数:13,
示例11: mainint main(int argc, char** argv) { if (argc < 3) { printf("Usage: jattach <pid> <cmd> <args> .../n"); return 1; } int pid = atoi(argv[1]); if (!check_socket(pid) && !start_attach_mechanism(pid)) { printf("Could not start attach mechanism/n"); return 1; } int fd = connect_socket(pid); if (fd == -1) { printf("Could not connect to socket/n"); return 1; } printf("Connected to remote JVM/n"); write_command(fd, argc - 2, argv + 2); printf("Response code = "); read_response(fd); printf("/n"); close(fd); return 0;}
开发者ID:anjanb,项目名称:jattach,代码行数:29,
示例12: mainint main(int argc,char *argv[]){ if(argc < 3) return usage(argc, argv); // set and check device name char* tmp=argv[1]; if(strcmp(tmp,"1") && strcmp(tmp,"2")) return usage(argc, argv); char devname[12]; sprintf(devname, "/dev/schar%s",tmp); printf("devname %s/n",devname); int commandnum = atoi( argv[2] ); printf("commandnum=%d/n",commandnum); int adrnum = 0; if (argc > 3){ adrnum = atoi( argv[3] ); printf("adrnum=%02x/n",adrnum); } // open device eth_open(devname); eth_register_mac(); int e=write_command(commandnum,adrnum); // close device eth_close(); return e;}
开发者ID:cbravo135,项目名称:emulator_control_sw,代码行数:31,
示例13: ili9340_draw_pixelvoid ili9340_draw_pixel(uint16_t x, uint16_t y, uint16_t color) { if (x >= ILI9340_HEIGHT) return; if (y >= ILI9340_WIDTH) return; write_command(0x2A); write_data_word(x); write_data_word(x); write_command(0x2B); write_data_word(y); write_data_word(y); write_command(0x2C); write_data_word(color);}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:16,
示例14: process_commandvoid process_command(char *command){ char *token; char *search = " "; strtok(command, "/n"); token = strtok(command, search); if (strcmp(token, "download") == 0) { token = strtok(NULL, search); int download_id = atoi(token); if (in_download_range(download_id)) { printf("Downloading %i", download_id); write_command(download_id); current_download = download_id; global_state = GotIndex; } else { printf("Log ID %i outside available range/n", download_id); need_input = true; } } else if (strcmp(token, "exit") == 0) { keep_running = false; } else { printf("Possible commands:/n" " download <lognumber>/n" " help/n" " exit/n"); need_input = true; }}
开发者ID:selimnuhoglu,项目名称:paparazzi,代码行数:33,
示例15: adjust_timeint adjust_time(){ long heure_serveur, heure_locale; int res,code; char *buf; Date_offset=0; write_command(CMD_DATE, 0, NULL); res=read_server_with_reconnect(tcp_line_read, 3, MAX_READ_SIZE-1); if (debug) fprintf(stderr,"Yo :%s/n",tcp_line_read); if (res<0) return -1; buf=strchr(tcp_line_read,' '); code = time(NULL); if (buf) { code=strtol(buf+9,&buf,10); heure_serveur=code %100 + 60*(((code/100)%100) + 60*(((code/10000)%100))); } else heure_serveur=code; heure_locale=time(NULL);/* heure_locale = mktime(gmtime(&heure_locale))%86400; */ Date_offset = ((heure_serveur - heure_locale)%86400); if (Date_offset > 43200) Date_offset = Date_offset - 86400; if (Date_offset < -43200) Date_offset = Date_offset + 86400; if (debug) fprintf(stderr,"Yu :%ld %ld %d/n",heure_serveur, heure_locale,Date_offset); return 0;}
开发者ID:Cigaes,项目名称:flrn,代码行数:29,
示例16: network_shutdownstatic void network_shutdown(struct iio_context *ctx){ struct iio_context_pdata *pdata = ctx->pdata; unsigned int i; iio_mutex_lock(pdata->lock); write_command("/r/nEXIT/r/n", pdata->fd); close(pdata->fd); iio_mutex_unlock(pdata->lock); for (i = 0; i < ctx->nb_devices; i++) { struct iio_device *dev = ctx->devices[i]; struct iio_device_pdata *dpdata = dev->pdata; if (dpdata) { network_close(dev); iio_mutex_destroy(dpdata->lock); free(dpdata); } } iiod_client_destroy(pdata->iiod_client); iio_mutex_destroy(pdata->lock); freeaddrinfo(pdata->addrinfo); free(pdata);}
开发者ID:lrmodesgh,项目名称:libiio,代码行数:26,
示例17: malloc/** * open_stream_for_write_2 * @filename: Filename of new stream * @geom_filename: The geometry filename to copy * @argc: The number of arguments to the program * @argv: The arguments to the program * * Creates a new stream with name @filename, and adds the stream format * and version header, plus a verbatim copy of the geometry file * * You may want to follow this with a call to write_command() to record the * command line. * * Returns: a %Stream, or NULL on failure. */Stream *open_stream_for_write_2(const char *filename, const char *geom_filename, int argc, char *argv[]){ Stream *st; st = malloc(sizeof(struct _stream)); if ( st == NULL ) return NULL; st->fh = fopen(filename, "w"); if ( st->fh == NULL ) { ERROR("Failed to open stream./n"); free(st); return NULL; } st->major_version = LATEST_MAJOR_VERSION; st->minor_version = LATEST_MINOR_VERSION; fprintf(st->fh, "CrystFEL stream format %i.%i/n", st->major_version, st->minor_version); fprintf(st->fh, "Generated by CrystFEL "CRYSTFEL_VERSIONSTRING"/n"); fflush(st->fh); if ( (argc > 0) && (argv != NULL) ) { write_command(st, argc, argv); } if ( geom_filename != NULL ) { write_geometry_file(st, geom_filename); } return st;}
开发者ID:kif,项目名称:CrystFEL,代码行数:49,
示例18: exec_commandstatic long exec_command(const char *cmd, int fd){ long resp; ssize_t ret = write_command(cmd, fd); if (ret < 0) return (long) ret; DEBUG("Reading response/n"); ret = read_integer(fd, &resp); if (ret < 0) { char buf[1024]; iio_strerror(-ret, buf, sizeof(buf)); ERROR("Unable to read response: %s/n", buf); return (long) ret; }#if LOG_LEVEL >= DEBUG_L if (resp < 0) { char buf[1024]; iio_strerror(-resp, buf, sizeof(buf)); DEBUG("Server returned an error: %s/n", buf); }#endif return resp;}
开发者ID:lrmodesgh,项目名称:libiio,代码行数:26,
示例19: network_closestatic int network_close(const struct iio_device *dev){ struct iio_device_pdata *pdata = dev->pdata; int ret = -EBADF; iio_mutex_lock(pdata->lock); if (pdata->fd >= 0) { ret = iiod_client_close_unlocked(dev->ctx->pdata->iiod_client, pdata->fd, dev); write_command("/r/nEXIT/r/n", pdata->fd); close(pdata->fd); pdata->fd = -1; }#ifdef WITH_NETWORK_GET_BUFFER if (pdata->memfd >= 0) close(pdata->memfd); pdata->memfd = -1; if (pdata->mmap_addr) { munmap(pdata->mmap_addr, pdata->mmap_len); pdata->mmap_addr = NULL; }#endif iio_mutex_unlock(pdata->lock); return ret;}
开发者ID:lrmodesgh,项目名称:libiio,代码行数:31,
示例20: priv_pcap_dump_openpcap_dumper_t *priv_pcap_dump_open(pcap_t *p, char *fname){ int fd, err; FILE *f; if (priv_fd < 0) errx(1, "%s: called from privileged portion", __func__); if (fname[0] == '-' && fname[1] == '/0') { f = stdout; priv_init_done(); } else { write_command(priv_fd, PRIV_OPEN_OUTPUT); fd = receive_fd(priv_fd); must_read(priv_fd, &err, sizeof(err)); if (fd < 0) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Failed to open output file %s: %s", fname, strerror(err)); return (NULL); } f = fdopen(fd, "w"); if (f == NULL) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", fname, pcap_strerror(errno)); close(fd); return (NULL); } } (void)sf_write_header(f, p->linktype, p->tzoff, p->snapshot); return ((pcap_dumper_t *)f);}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:34,
示例21: set_window/* * Set address window. */static void set_window(int x0, int y0, int x1, int y1){ write_command(S6D04H0_Column_Address_Set); write_data(x0 >> 8); gpanel_write_byte(x0); gpanel_write_byte(x1 >> 8); gpanel_write_byte(x1); write_command(S6D04H0_Page_Address_Set); write_data(y0 >> 8); gpanel_write_byte(y0); gpanel_write_byte(y1 >> 8); gpanel_write_byte(y1); write_command(S6D04H0_Memory_Write);}
开发者ID:jdstroy,项目名称:retrobsd,代码行数:19,
示例22: set_rotation/* * Switch the screen orientation. */static void set_rotation(int rotation){ write_command(S6D04H0_Memory_Data_Access_Control); switch (rotation & 3) { case 0: /* Portrait */ write_data(MADCTL_MY | MADCTL_BGR); _width = 240; _height = 320; break; case 1: /* Landscape */ write_data(MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR); _width = 320; _height = 240; break; case 2: /* Upside down portrait */ write_data(MADCTL_MX | MADCTL_BGR); _width = 240; _height = 320; break; case 3: /* Upside down landscape */ write_data(MADCTL_MV | MADCTL_BGR); _width = 320; _height = 240; break; }}
开发者ID:jdstroy,项目名称:retrobsd,代码行数:29,
|