当前位置: 首页>>代码示例>>C++>>正文


C++ write_index函数代码示例

本文整理汇总了C++中write_index函数的典型用法代码示例。如果您正苦于以下问题:C++ write_index函数的具体用法?C++ write_index怎么用?C++ write_index使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了write_index函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set_backlight

// On this controller the back-light is controlled by the controllers internal PWM
//	which is why it is in this file rather than the board file.
static inline void set_backlight(GDisplay* g, uint8_t percent) {
	uint8_t temp;

	//Work in progress: the RA8875 has a built-in PWM, its output can
	//be used by a Dynamic Background Control or by a host (user)

	// Enable PWM1
	write_index(g, 0x8a);						//MCLR
	setreadmode(g);
	temp = read_data(g);
	setwritemode(g);
	temp |= 1<<7 ;
	write_data(g, temp);

	// PWM1 function select
	write_index(g, 0x8a);						//MCLR
	setreadmode(g);
	temp = read_data(g);
	setwritemode(g);
	temp &= ~(1<<4);
	write_data(g, temp);

	// PWM1 Clock ratio
	write_index(g, 0x8a);						//MCLR
	setreadmode(g);
	temp = read_data(g);
	setwritemode(g);
	temp &= 0xf0;
	temp |= 0x0b & 0x0f;
	write_data(g, temp);

	// PWM1 Write duty cycle
	write_reg8(g, 0x8b, 54+percent);			// PTNO: Also change percent to range from 0x00 to 0xFF
}
开发者ID:bhdminh,项目名称:uGFX,代码行数:36,代码来源:gdisp_lld_RA8875.c

示例2: set_viewport

static inline void set_viewport(GDisplay* g) {
	write_index(g, SSD1963_SET_PAGE_ADDRESS);
	write_data16(g, g->p.y);
	write_data16(g, g->p.y+g->p.cy-1);
	write_index(g, SSD1963_SET_COLUMN_ADDRESS);
	write_data16(g, g->p.x);
	write_data16(g, g->p.x+g->p.cx-1);
	write_index(g, SSD1963_WRITE_MEMORY_START);
}
开发者ID:kleopatra999,项目名称:arm_mcu,代码行数:9,代码来源:gdisp_lld_SSD1963.c

示例3: read_index

bool CommandRenumber::run() {
    if (!m_index_directory.empty()) {
        m_vout << "Reading index files...\n";
        read_index(osmium::item_type::node, "nodes");
        read_index(osmium::item_type::way, "ways");
        read_index(osmium::item_type::relation, "relations");

        m_vout << "  Nodes     index contains " << index(osmium::item_type::node).size()     << " items\n";
        m_vout << "  Ways      index contains " << index(osmium::item_type::way).size()      << " items\n";
        m_vout << "  Relations index contains " << index(osmium::item_type::relation).size() << " items\n";
    }

    m_vout << "First pass through input file (reading relations)...\n";
    osmium::io::Reader reader_pass1(m_input_file, osmium::osm_entity_bits::relation);

    osmium::io::Header header = reader_pass1.header();
    header.set("generator", m_generator);
    header.set("xml_josm_upload", "false");
    for (const auto& h : m_output_headers) {
        header.set(h);
    }
    osmium::io::Writer writer(m_output_file, header, m_output_overwrite);

    osmium::io::InputIterator<osmium::io::Reader, osmium::Relation> it { reader_pass1 };
    osmium::io::InputIterator<osmium::io::Reader, osmium::Relation> end {};

    for (; it != end; ++it) {
        lookup(osmium::item_type::relation, it->id());
    }

    reader_pass1.close();

    m_vout << "Second pass through input file...\n";
    osmium::io::Reader reader_pass2(m_input_file);
    while (osmium::memory::Buffer buffer = reader_pass2.read()) {
        renumber(buffer);
        writer(std::move(buffer));
    }
    reader_pass2.close();

    writer.close();

    if (!m_index_directory.empty()) {
        m_vout << "Writing index files...\n";
        write_index(osmium::item_type::node, "nodes");
        write_index(osmium::item_type::way, "ways");
        write_index(osmium::item_type::relation, "relations");
    }

    m_vout << "Done.\n";

    return true;
}
开发者ID:sebastic,项目名称:osmium-tool,代码行数:53,代码来源:command_renumber.cpp

示例4: write_field

static void write_field(FILE *f, const save_field_t *field, void *base)
{
    void *p = (byte *)base + field->ofs;
    int i;

    switch (field->type) {
    case F_BYTE:
        write_data(p, field->size, f);
        break;
    case F_SHORT:
        for (i = 0; i < field->size; i++) {
            write_short(f, ((short *)p)[i]);
        }
        break;
    case F_INT:
        for (i = 0; i < field->size; i++) {
            write_int(f, ((int *)p)[i]);
        }
        break;
    case F_FLOAT:
        for (i = 0; i < field->size; i++) {
            write_float(f, ((float *)p)[i]);
        }
        break;
    case F_VECTOR:
        write_vector(f, (vec_t *)p);
        break;

    case F_ZSTRING:
        write_string(f, (char *)p);
        break;
    case F_LSTRING:
        write_string(f, *(char **)p);
        break;

    case F_EDICT:
        write_index(f, *(void **)p, sizeof(edict_t), g_edicts, MAX_EDICTS - 1);
        break;
    case F_CLIENT:
        write_index(f, *(void **)p, sizeof(gclient_t), game.clients, game.maxclients - 1);
        break;
    case F_ITEM:
        write_index(f, *(void **)p, sizeof(gitem_t), itemlist, game.num_items - 1);
        break;

    case F_POINTER:
        write_pointer(f, *(void **)p, field->size);
        break;

    default:
        gi.error("%s: unknown field type", __func__);
    }
}
开发者ID:Jenco420,项目名称:q2pro,代码行数:53,代码来源:g_save.c

示例5: set_viewport

static void set_viewport(GDisplay *g) {
	write_index(g, 0x2A);
	write_data(g, (g->p.x >> 8));
	write_data(g, (uint8_t) g->p.x);
	write_data(g, (g->p.x + g->p.cx - 1) >> 8);
	write_data(g, (uint8_t) (g->p.x + g->p.cx - 1));

	write_index(g, 0x2B);
	write_data(g, (g->p.y >> 8));
	write_data(g, (uint8_t) g->p.y);
	write_data(g, (g->p.y + g->p.cy - 1) >> 8);
	write_data(g, (uint8_t) (g->p.y + g->p.cy - 1));
}
开发者ID:kleopatra999,项目名称:arm_mcu,代码行数:13,代码来源:gdisp_lld_ILI9341.c

示例6: set_cursor

static void set_cursor(GDisplay* g) {
	/* Reg SSD2119_REG_X_RAM_ADDR is 9 bit value
	 * Reg SSD2119_REG_Y_RAM_ADDR is an 8 bit
	 * Use a bit mask to make sure they are not set too high
	 */
	switch(g->g.Orientation) {
		default:
		case GDISP_ROTATE_0:
			write_reg(g, SSD2119_REG_X_RAM_ADDR, g->p.x & 0x01FF);
			write_reg(g, SSD2119_REG_Y_RAM_ADDR, g->p.y & 0x00FF);
			break;
		case GDISP_ROTATE_90:
			write_reg(g, SSD2119_REG_X_RAM_ADDR, g->p.y & 0x01FF);
			write_reg(g, SSD2119_REG_Y_RAM_ADDR, (GDISP_SCREEN_HEIGHT-1 - g->p.x) & 0x00FF);
			break;
		case GDISP_ROTATE_180:
			write_reg(g, SSD2119_REG_X_RAM_ADDR, (GDISP_SCREEN_WIDTH-1 - g->p.x) & 0x01FF);
			write_reg(g, SSD2119_REG_Y_RAM_ADDR, (GDISP_SCREEN_HEIGHT-1 - g->p.y) & 0x00FF);
			break;
		case GDISP_ROTATE_270:
			write_reg(g, SSD2119_REG_X_RAM_ADDR, (GDISP_SCREEN_WIDTH-1 - g->p.y) & 0x01FF);
			write_reg(g, SSD2119_REG_Y_RAM_ADDR, g->p.x & 0x00FF);
			break;
	}
	write_index(g, SSD2119_REG_RAM_DATA);
}
开发者ID:bunnie,项目名称:chibi-ugfx,代码行数:26,代码来源:gdisp_lld_SSD2119.c

示例7: main

int main() {

	int ret;

	write_index();

	// All defaults. Bind to all interfaces, port 2001, default plugins, /tmp.
	// No callbacks are used.
	mklib_ctx ctx = mklib_init(NULL, 0, 0, "/tmp");
	if (!ctx) return 1;

	// The default has no index files, let's set index.html as one.
	ret = mklib_config(ctx, MKC_INDEXFILE, "index.html", NULL);
	if (!ret) return 1;

	// Start the server.
	mklib_start(ctx);

	// I'm now free to do my own things. I'm just going to wait for a keypress.
	printf("All set and running! Visit me, I default to localhost:2001.\n");
	printf("Press a key to exit.\n");
	getchar();

	mklib_stop(ctx);

	return 0;
}
开发者ID:alepharchives,项目名称:monkey,代码行数:27,代码来源:hello.c

示例8: write_header

static int write_header(AVFormatContext *s)
{
    AVIOContext *pb = s->pb;
    WtvContext *wctx = s->priv_data;
    int i, pad, ret;
    AVStream *st;

    wctx->last_chunk_pos     = -1;
    wctx->last_timestamp_pos = -1;

    ff_put_guid(pb, &ff_wtv_guid);
    ff_put_guid(pb, &sub_wtv_guid);

    avio_wl32(pb, 0x01);
    avio_wl32(pb, 0x02);
    avio_wl32(pb, 1 << WTV_SECTOR_BITS);
    avio_wl32(pb, 1 << WTV_BIGSECTOR_BITS);

    //write initial root fields
    avio_wl32(pb, 0); // root_size, update later
    write_pad(pb, 4);
    avio_wl32(pb, 0); // root_sector, update it later.

    write_pad(pb, 32);
    avio_wl32(pb, 0); // file ends pointer, update it later.

    pad = (1 << WTV_SECTOR_BITS) - avio_tell(pb);
    write_pad(pb, pad);

    wctx->timeline_start_pos = avio_tell(pb);

    wctx->serial = 1;
    wctx->last_chunk_pos = -1;
    wctx->first_video_flag = 1;

    for (i = 0; i < s->nb_streams; i++) {
        st = s->streams[i];
        ret = write_stream_codec(s, st);
        if (ret < 0) {
            av_log(s, AV_LOG_ERROR, "write stream codec failed codec_type(0x%x)\n", st->codec->codec_type);
            return -1;
        }
        if (!i)
            write_sync(s);
    }

    for (i = 0; i < s->nb_streams; i++) {
        st = s->streams[i];
        ret  = write_stream_data(s, st);
        if (ret < 0) {
            av_log(s, AV_LOG_ERROR, "write stream data failed codec_type(0x%x)\n", st->codec->codec_type);
            return -1;
        }
    }

    if (wctx->nb_index)
        write_index(s);

    return 0;
}
开发者ID:kcm1700,项目名称:VideoSplitter,代码行数:60,代码来源:wtvenc.c

示例9: finish_chunk

static void finish_chunk(AVFormatContext *s)
{
    WtvContext *wctx = s->priv_data;
    finish_chunk_noindex(s);
    if (wctx->nb_index == MAX_NB_INDEX)
        write_index(s);
}
开发者ID:kcm1700,项目名称:VideoSplitter,代码行数:7,代码来源:wtvenc.c

示例10: set_cursor

static void set_cursor(GDisplay *g) {
	/*
	 * Reg 0x004E is an 8 bit value - start x position
	 * Reg 0x004F is 9 bit - start y position
	 * Use a bit mask to make sure they are not set too high
	 */
	switch(g->g.Orientation) {
		default:
		case GDISP_ROTATE_0:
			write_reg(g, 0x4e, g->p.x & 0x00FF);
			write_reg(g, 0x4f, g->p.y & 0x01FF);
			break;
		case GDISP_ROTATE_90:
			write_reg(g, 0x4e, g->p.y & 0x00FF);
			write_reg(g, 0x4f, (GDISP_SCREEN_HEIGHT-1-g->p.x) & 0x01FF);
			break;
		case GDISP_ROTATE_180:
			write_reg(g, 0x4e, (GDISP_SCREEN_WIDTH-1-g->p.x) & 0x00FF);
			write_reg(g, 0x4f, (GDISP_SCREEN_HEIGHT-1-g->p.y) & 0x01FF);
			break;
		case GDISP_ROTATE_270:
			write_reg(g, 0x4e, (GDISP_SCREEN_WIDTH-1-g->p.y) & 0x00FF);
			write_reg(g, 0x4f, g->p.x & 0x01FF);
			break;
	}
	write_index(g, 0x22);
}
开发者ID:bigzed,项目名称:uGFX,代码行数:27,代码来源:gdisp_lld_SSD1289.c

示例11: gdisp_lld_fill_area

	/**
	 * @brief   Fill an area with a color.
	 * @note    Optional - The high level driver can emulate using software.
	 *
	 * @param[in] x, y     The start filled area
	 * @param[in] cx, cy   The width and height to be filled
	 * @param[in] color    The color of the fill
	 *
	 * @notapi
	 */
	void gdisp_lld_fill_area(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) {
		uint32_t area;
    
		#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
			if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; x = GDISP.clipx0; }
			if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; y = GDISP.clipy0; }
			if (cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
			if (x+cx > GDISP.clipx1)	cx = GDISP.clipx1 - x;
			if (y+cy > GDISP.clipy1)	cy = GDISP.clipy1 - y;
		#endif
		
		area = cx*cy;

		gdisp_lld_setwindow(x, y, x+cx-1, y+cy-1);
		write_index(RA8875_WRITE_MEMORY_START);

		#if defined(GDISP_USE_FSMC) && defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
			uint8_t i;
			dmaStreamSetPeripheral(GDISP_DMA_STREAM, &color);
			dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);  
			for (i = area/65535; i; i--) {
				dmaStreamSetTransactionSize(GDISP_DMA_STREAM, 65535);
				dmaStreamEnable(GDISP_DMA_STREAM);
				dmaWaitCompletion(GDISP_DMA_STREAM);
			}
			dmaStreamSetTransactionSize(GDISP_DMA_STREAM, area%65535);
			dmaStreamEnable(GDISP_DMA_STREAM);
			dmaWaitCompletion(GDISP_DMA_STREAM);
		#else
			uint32_t index;
			for(index = 0; index < area; index++)
				write_data(color);
		#endif  //#ifdef GDISP_USE_DMA
}
开发者ID:resset,项目名称:ChibiOS-GFX,代码行数:44,代码来源:gdisp_lld.c

示例12: cmd_write

static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) {
    (void)argc;
    (void)argv;

    acquire_bus();

    write_index(0x00);
    chprintf(chp,"Device ID %x\r\n",read_data());
    release_bus();
    //chprintf(chp,"GRAM %x\r\n",gdispReadReg(0x22));
 
    /*gdispClear(White);
    chThdSleepMilliseconds(3000);
    gdispClear(Red);
    chThdSleepMilliseconds(3000);
    gdispClear(Blue);
    chThdSleepMilliseconds(3000);
    gdispClear(Green);*/
    #if 0
    uint8_t c = 0xAA;
    uint8_t d = 0x55;

    spiAcquireBus(&SPID1);              /* Acquire ownership of the bus.    */
    spiStart(&SPID1, &spicfg);       /* Setup transfer parameters.       */
    spiSelect(&SPID1);                  /* Slave Select assertion.          */

    spiSend(&SPID1, 1, &c);
    spiSend(&SPID1, 1, &d);

    spiUnselect(&SPID1);                /* Slave Select de-assertion.       */
    spiReleaseBus(&SPID1);              /* Ownership release.               */
    #endif
}
开发者ID:bass0324,项目名称:Bass-GFX-Examples,代码行数:33,代码来源:main.c

示例13: update_index

int
update_index (struct index_state *istate, const char *index_path)
{
    char index_shadow[PATH_MAX];
    int index_fd;
    int ret = 0;

    snprintf (index_shadow, PATH_MAX, "%s.shadow", index_path);
    index_fd = g_open (index_shadow, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0666);
    if (index_fd < 0) {
        g_warning ("Failed to open shadow index: %s.\n", strerror(errno));
        return -1;
    }

    if (write_index (istate, index_fd) < 0) {
        g_warning ("Failed to write shadow index: %s.\n", strerror(errno));
        return -1;
    }
    close (index_fd);

    ret = ccnet_rename (index_shadow, index_path);
    if (ret < 0) {
        g_warning ("Failed to update index errno=%d %s\n", errno, strerror(errno));
        return -1;
    }
    return 0;
}
开发者ID:2bj,项目名称:seafile,代码行数:27,代码来源:vc-utils.c

示例14: git_index_write

int git_index_write(git_index *index)
{
	git_filebuf file;
	struct stat indexst;
	int error;

	git_vector_sort(&index->entries);

	if ((error = git_filebuf_open(&file, index->index_file_path, GIT_FILEBUF_HASH_CONTENTS)) < GIT_SUCCESS)
		return git__rethrow(error, "Failed to write index");

	if ((error = write_index(index, &file)) < GIT_SUCCESS) {
		git_filebuf_cleanup(&file);
		return git__rethrow(error, "Failed to write index");
	}

	if ((error = git_filebuf_commit(&file)) < GIT_SUCCESS)
		return git__rethrow(error, "Failed to write index");

	if (p_stat(index->index_file_path, &indexst) == 0) {
		index->last_modified = indexst.st_mtime;
		index->on_disk = 1;
	}

	return GIT_SUCCESS;
}
开发者ID:boyski,项目名称:libgit2,代码行数:26,代码来源:index.c

示例15: fill_gap

static void fill_gap(indexer_dv_context *This, int isPAL)
{
	int i;

	for (i = 0; i < This->fsize; i++) {
		if (This->gap_start == This->ref_time_read &&
		    This->gap_frame == This->curr_frame)
		{
			fprintf(stderr,
			        "indexer_dv::fill_gap: "
			        "can't seek backwards !\n");
			break;
		}
		inc_frame(&This->gap_frame, &This->gap_start, isPAL);
	}

	while (This->gap_start != This->ref_time_read ||
	       This->gap_frame != This->curr_frame)
	{
		inc_frame(&This->gap_frame, &This->gap_start, isPAL);
		This->frameno_offset++;
	}

	for (i = 0; i < This->fsize; i++) {
		write_index(This, This->backbuffer + i);
	}
	This->fsize = 0;
}
开发者ID:244xiao,项目名称:blender,代码行数:28,代码来源:indexer_dv.c


注:本文中的write_index函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。