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


C++ release_bus函数代码示例

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


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

示例1: lld_gdisp_draw_pixel

/**
 * @brief   Draws a pixel on the display.
 *
 * @param[in] x        X location of the pixel
 * @param[in] y        Y location of the pixel
 * @param[in] color    The color of the pixel
 *
 * @notapi
 */
void lld_gdisp_draw_pixel(coord_t x, coord_t y, color_t color) {
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
    if (x < GDISP.clipx0 || y < GDISP.clipy0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
#endif

    acquire_bus();
    set_cursor(x, y);
    write_reg(0x0022, color);
    release_bus();
}
开发者ID:etmatrix,项目名称:ChibiOS-GFX,代码行数:19,代码来源:gdisp_lld.c

示例2: gdisp_lld_fill_area

	LLDSPEC void gdisp_lld_fill_area(GDisplay *g) {
		uint16_t	c;

		c = gdispColor2Native(g->p.color);
		acquire_bus(g);
		set_viewport(g);
		set_cursor(g);
		dma_with_noinc(g, &c, g->p.cx*g->p.cy);
		release_bus(g);
	}
开发者ID:bhdminh,项目名称:uGFX,代码行数:10,代码来源:gdisp_lld_ST7781.c

示例3: GDISP_LLD

	/**
	 * @brief   Scroll vertically a section of the screen.
	 * @note    Optional.
	 * @note    If x,y + cx,cy is off the screen, the result is undefined.
	 * @note    If lines is >= cy, it is equivelent to a area fill with bgcolor.
	 *
	 * @param[in] x, y     The start of the area to be scrolled
	 * @param[in] cx, cy   The size of the area to be scrolled
	 * @param[in] lines    The number of lines to scroll (Can be positive or negative)
	 * @param[in] bgcolor  The color to fill the newly exposed area.
	 *
	 * @notapi
	 */
	void GDISP_LLD(verticalscroll)(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor) {
		/* This is marked as "TODO: Test this" in the original GLCD driver.
		 * For now we just leave the GDISP_HARDWARE_SCROLL off.
		 */
		static color_t buf[((GDISP_SCREEN_HEIGHT > GDISP_SCREEN_WIDTH ) ? GDISP_SCREEN_HEIGHT : GDISP_SCREEN_WIDTH)];
		coord_t row0, row1;
		unsigned i, gap, abslines;

		#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 (!lines || 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

		abslines = lines < 0 ? -lines : lines;

		acquire_bus();
		if (abslines >= cy) {
			abslines = cy;
			gap = 0;
		} else {
			gap = cy - abslines;
			for(i = 0; i < gap; i++) {
				if(lines > 0) {
					row0 = y + i + lines;
					row1 = y + i;
				} else {
					row0 = (y - i - 1) + lines;
					row1 = (y - i - 1);
				}

				/* read row0 into the buffer and then write at row1*/
				set_viewport(x, row0, cx, 1);
				lld_lcdReadStreamStart();
				lld_lcdReadStream(buf, cx);
				lld_lcdReadStreamStop();

				set_viewport(x, row1, cx, 1);
				stream_start();
				write_data(buf, cx);
				stream_stop();
			}
		}

		/* fill the remaining gap */
		set_viewport(x, lines > 0 ? (y+gap) : y, cx, abslines);
		stream_start();
		gap = cx*abslines;
		for(i = 0; i < gap; i++) write_data(bgcolor);
		stream_stop();
		reset_viewport();
		release_bus();
	}
开发者ID:lord67,项目名称:ChibiOS-GFX,代码行数:68,代码来源:gdisp_lld.c

示例4: lld_gdisp_vertical_scroll

	/**
	 * @brief   Scroll vertically a section of the screen.
	 * @note    Optional.
	 * @note    If x,y + cx,cy is off the screen, the result is undefined.
	 * @note    If lines is >= cy, it is equivelent to a area fill with bgcolor.
	 *
	 * @param[in] x, y     The start of the area to be scrolled
	 * @param[in] cx, cy   The size of the area to be scrolled
	 * @param[in] lines    The number of lines to scroll (Can be positive or negative)
	 * @param[in] bgcolor  The color to fill the newly exposed area.
	 *
	 * @notapi
	 */
	void lld_gdisp_vertical_scroll(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor) {
		static color_t buf[((GDISP_SCREEN_HEIGHT > GDISP_SCREEN_WIDTH ) ? GDISP_SCREEN_HEIGHT : GDISP_SCREEN_WIDTH)];
		coord_t row0, row1;
		unsigned i, gap, abslines, j;

		#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 (!lines || 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

		abslines = lines < 0 ? -lines : lines;

		acquire_bus();
		if (abslines >= cy) {
			abslines = cy;
			gap = 0;
		} else {
			gap = cy - abslines;
			for(i = 0; i < gap; i++) {
				if(lines > 0) {
					row0 = y + i + lines;
					row1 = y + i;
				} else {
					row0 = (y - i - 1) + lines;
					row1 = (y - i - 1);
				}

				/* read row0 into the buffer and then write at row1*/
				set_viewport(x, row0, cx, 1);
				stream_start();
				j = read_data();			// dummy read
				for (j = 0; j < cx; j++)
					buf[j] = read_data();
				stream_stop();

				set_viewport(x, row1, cx, 1);
				stream_start();
				for (j = 0; j < cx; j++)
					write_data(buf[j]);
				stream_stop();
			}
		}

		/* fill the remaining gap */
		set_viewport(x, lines > 0 ? (y+gap) : y, cx, abslines);
		stream_start();
		gap = cx*abslines;
		for(i = 0; i < gap; i++) write_data(bgcolor);
		stream_stop();
		release_bus();
	}
开发者ID:etmatrix,项目名称:ChibiOS-GFX,代码行数:67,代码来源:gdisp_lld.c

示例5: lld_gdisp_clear

	/**
	 * @brief   Clear the display.
	 * @note    Optional - The high level driver can emulate using software.
	 *
	 * @param[in] color    The color of the pixel
	 *
	 * @notapi
	 */
	void lld_gdisp_clear(color_t color) {
		unsigned i;

		acquire_bus();
		reset_viewport();
		set_cursor(0, 0);
		stream_start();
		for(i = 0; i < GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT; i++)
			write_data(color);
		stream_stop();
		release_bus();
	}
开发者ID:etmatrix,项目名称:ChibiOS-GFX,代码行数:20,代码来源:gdisp_lld.c

示例6: gdisp_lld_fill_area

	LLDSPEC void gdisp_lld_fill_area(GDisplay* g) {
		#if GDISP_NO_DMA_FROM_STACK
			static LLDCOLOR_TYPE	c;
		#else
			LLDCOLOR_TYPE	c;
		#endif

		c = gdispColor2Native(g->p.color);
		acquire_bus(g);
		set_viewport(g);
		set_cursor(g);	
		dma_with_noinc(g, &c, g->p.cx * g->p.cy);
		release_bus(g);
	}
开发者ID:bunnie,项目名称:chibi-ugfx,代码行数:14,代码来源:gdisp_lld_SSD2119.c

示例7: gdisp_lld_blit_area

	LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
		pixel_t		*buffer;
		coord_t		ycnt;

		buffer = (pixel_t *)g->p.ptr + g->p.x1 + g->p.y1 * g->p.x2;

		acquire_bus(g);
		set_viewport(g);
		set_cursor(g);
		if (g->p.x2 == g->p.cx) {
			dma_with_inc(g, buffer, g->p.cx*g->p.cy);
		} else {
			for (ycnt = g->p.cy; ycnt; ycnt--, buffer += g->p.x2)
				dma_with_inc(g, buffer, g->p.cy);
		}
		release_bus(g);
	}
开发者ID:bigzed,项目名称:uGFX,代码行数:17,代码来源:gdisp_lld_SSD1289.c

示例8: lld_gdisp_get_pixel_color

	/**
	 * @brief   Get the color of a particular pixel.
	 * @note    Optional.
	 * @note    If x,y is off the screen, the result is undefined.
	 *
	 * @param[in] x, y     The pixel to be read
	 *
	 * @notapi
	 */
	color_t lld_gdisp_get_pixel_color(coord_t x, coord_t y) {
		color_t color;

		#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
			if (x < 0 || x >= GDISP.Width || y < 0 || y >= GDISP.Height) return 0;
		#endif

		acquire_bus();
		set_cursor(x, y);
		stream_start();
		color = read_data();			// dummy read
		color = read_data();
		stream_stop();
		release_bus();

		return color;
	}
开发者ID:etmatrix,项目名称:ChibiOS-GFX,代码行数:26,代码来源:gdisp_lld.c

示例9: ginput_lld_mouse_get_reading

/**
 * @brief   Read the mouse/touch position.
 *
 * @param[in] pt	A pointer to the structure to fill
 *
 * @note			For drivers that don't support returning a position
 *					when the touch is up (most touch devices), it should
 *					return the previous position with the new Z value.
 *					The z value is the pressure for those touch devices
 *					that support it (-100 to 100 where > 0 is touched)
 *					or, 0 or 100 for those drivers that don't.
 *
 * @notapi
 */
void ginput_lld_mouse_get_reading(MouseReading *pt) {
	uint16_t i;

	// If touch-off return the previous results
	if (!getpin_pressed()) {
		pt->x = lastx;
		pt->y = lasty;
		pt->z = 0;
		pt->buttons = 0;
		return;
	}
	
	// Read the port to get the touch settings
	aquire_bus();

	/* Get the X value
	 * Discard the first conversion - very noisy and keep the ADC on hereafter
	 * till we are done with the sampling. Note that PENIRQ is disabled while reading.
	 * Finally switch on PENIRQ once again - perform a dummy read.
	 * Once we have the readings, find the medium using our filter function
 	 */
	read_value(0xD1);
	for(i = 0; i < 7; i++)
		sampleBuf[i] = read_value(0xD1);
	read_value(0xD0);
	filter();
	lastx = (coord_t)sampleBuf[3];

	/* Get the Y value using the same process as above */
	read_value(0x91);
	for(i = 0; i < 7; i++)
		sampleBuf[i] = read_value(0x91);
	read_value(0x90);
	filter();
	lasty = (coord_t)sampleBuf[3];

	// Release the bus
	release_bus();
	
	// Return the results
	pt->x = lastx;
	pt->y = lasty;
	pt->z = 100;
	pt->buttons = GINPUT_TOUCH_PRESSED;
}
开发者ID:GottZ,项目名称:olvfw,代码行数:59,代码来源:ginput_lld_mouse.c

示例10: gdisp_lld_clear

 LLDSPEC void gdisp_lld_clear(GDisplay *g) {
   acquire_bus(g);
   write_cmd(g, SSD1327_SET_COLUMN_ADDRESS);
   write_data(g, 0);
   write_data(g, GDISP_SCREEN_WIDTH - 1);
   write_cmd(g, SSD1327_SET_ROW_ADDRESS);
   write_data(g, 0);
   write_data(g, GDISP_SCREEN_HEIGHT - 1);
   write_cmd(g, SSD1327_WRITE_RAM);
   LLDCOLOR_TYPE c;
   c = gdispColor2Native(g->p.color);
   uint16_t i = 0;
   for (i = 0; i < GDISP_SCREEN_WIDTH*GDISP_SCREEN_HEIGHT; i++)
   {
     write_data(g, c >> 8);
     write_data(g, c & 0xFF);
   }
   release_bus(g);
 }
开发者ID:cosmikwolf,项目名称:ArduinoLibraries,代码行数:19,代码来源:gdisp_lld_SSD1327.c

示例11: gdisp_lld_init

LLDSPEC bool_t gdisp_lld_init(GDisplay *g)
{
	// No private area for this controller
	g->priv = 0;

	// Initialise the board interface
	init_board(g);

	// Hardware reset
	setpin_reset(g, TRUE);
	delayms(100);
	setpin_reset(g, FALSE);
	delayms(100);

	acquire_bus(g);

	const uint16_t *list = &lcd_init_list[0];
	uint8_t size = sizeof(lcd_init_list) / sizeof(lcd_init_list[0]);

	while(size--) {
		write_index(g, *list++);
	}

	// Finish Init
	post_init_board(g);

	release_bus(g);

	// Turn on the back-light
	set_backlight(g, GDISP_INITIAL_BACKLIGHT);

	// Initialise the GDISP structure to match 
	g->g.Width = GDISP_SCREEN_WIDTH;
	g->g.Height = GDISP_SCREEN_HEIGHT;
	g->g.Orientation = GDISP_ROTATE_0;
	g->g.Powermode = powerOn;
	g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
	g->g.Contrast = GDISP_INITIAL_CONTRAST;

	return TRUE;
}
开发者ID:bunnie,项目名称:chibi-ugfx,代码行数:41,代码来源:gdisp_lld_SPFD54124B.c

示例12: MouseInit

/**
 * Notes:
 *
 * This chip has some problems which required careful coding to overcome.
 *
 * The interrupt pin seems to be unreliable, at least on some boards, so we at most
 * 	use the pin for filtering results to reduce cpu load.
 * 	The symptoms are that readings will just stop due to the irq not being asserted
 * 	even though there are items in the fifo. Another interrupt source such as a
 * 	touch transition will restart the irq.
 *
 * There is no fifo entry created when a touch up event occurs. We must therefore
 * 	generate a pseudo result on touch up. Fortunately the touch detection appears
 * 	reliable and so we turn off the driver GMOUSE_VFLG_POORUPDOWN setting. In practice
 * 	if touch is up we always return a pseudo event as this saves having to remember the
 * 	previous touch state.
 *
 * Z readings range from around 90 (fully touched) to around 150 (on the verge of non-touched).
 * Note the above is on the STM32F429i-Discovery board. Other boards may be different.
 * To be conservative we use 255 as touch off, anything else is a touch on.
 *
 * GMOUSE_STMPE811_TEST_MODE is designed to be used with the "touch_raw_readings" tool which shows
 * a steady stream of raw readings.
 *
 * Settings that may need tweaking on other hardware:
 * 		The settling times. We have set these conservatively at 1ms.
 * 		The reading window. We set this to 16 just to reduce noise. High-res panels may need a lower value.
 */
static bool_t MouseInit(GMouse* m, unsigned driverinstance) {
	if (!init_board(m, driverinstance))
		return FALSE;

	aquire_bus(m);

	write_reg(m, STMPE811_REG_SYS_CTRL1, 0x02);		// Software chip reset
	gfxSleepMilliseconds(10);

	write_reg(m, STMPE811_REG_SYS_CTRL2, 0x0C);		// Temperature sensor clock off, GPIO clock off, touch clock on, ADC clock on

	#if GMOUSE_STMPE811_GPIO_IRQPIN
		write_reg(m, STMPE811_REG_INT_EN, 0x03);	// Interrupt on INT pin when there is a sample or a touch transition.
	#else
		write_reg(m, STMPE811_REG_INT_EN, 0x00);	// Don't Interrupt on INT pin
	#endif

	write_reg(m, STMPE811_REG_ADC_CTRL1, 0x48);		// ADC conversion time = 80 clock ticks, 12-bit ADC, internal voltage refernce
	gfxSleepMilliseconds(2);
	write_reg(m, STMPE811_REG_ADC_CTRL2, 0x01);		// ADC speed 3.25MHz
	write_reg(m, STMPE811_REG_GPIO_AF, 0x00);		// GPIO alternate function - OFF
	write_reg(m, STMPE811_REG_TSC_CFG, 0xA3);		// Averaging 4, touch detect delay 1ms, panel driver settling time 1ms
	write_reg(m, STMPE811_REG_FIFO_TH, 0x01);		// FIFO threshold = 1
	write_reg(m, STMPE811_REG_FIFO_STA, 0x01);		// FIFO reset enable
	write_reg(m, STMPE811_REG_FIFO_STA, 0x00);		// FIFO reset disable
	write_reg(m, STMPE811_REG_TSC_FRACT_XYZ, 0x07);	// Z axis data format
	write_reg(m, STMPE811_REG_TSC_I_DRIVE, 0x01);	// max 50mA touchscreen line current
	#if GMOUSE_STMPE811_READ_PRESSURE
		write_reg(m, STMPE811_REG_TSC_CTRL, 0x30);	// X&Y&Z, 16 reading window
		write_reg(m, STMPE811_REG_TSC_CTRL, 0x31);	// X&Y&Z, 16 reading window, TSC enable
	#else
		write_reg(m, STMPE811_REG_TSC_CTRL, 0x32);	// X&Y, 16 reading window
		write_reg(m, STMPE811_REG_TSC_CTRL, 0x33);	// X&Y, 16 reading window, TSC enable
	#endif
	write_reg(m, STMPE811_REG_INT_STA, 0xFF);		// Clear all interrupts
	write_reg(m, STMPE811_REG_INT_CTRL, 0x01);		// Level interrupt, enable interrupts

	release_bus(m);
	return TRUE;
}
开发者ID:bigzed,项目名称:uGFX,代码行数:68,代码来源:gmouse_lld_STMPE811.c

示例13: gdisp_lld_fill_area

  LLDSPEC void gdisp_lld_fill_area(GDisplay *g) {
    coord_t x = g->p.x;
    coord_t y = g->p.y;
    coord_t w = g->p.cx;
    coord_t h = g->p.cy;
    LLDCOLOR_TYPE c = g->p.color;

    acquire_bus(g);
    write_cmd(g, SSD1327_SET_COLUMN_ADDRESS);
    write_data(g, x);
    write_data(g, x + w -1);
    write_cmd(g, SSD1327_SET_ROW_ADDRESS);
    write_data(g, y);
    write_data(g, y + h - 1);
    write_cmd(g, SSD1327_WRITE_RAM);
    uint16_t i = 0;
    for (i = 0; i < w*h; i++)
    {
      write_data(g, c >> 8);
      write_data(g, c & 0xFF);
    }
    release_bus(g);
  }
开发者ID:cosmikwolf,项目名称:ArduinoLibraries,代码行数:23,代码来源:gdisp_lld_SSD1327.c

示例14: GDISP_LLD

/**
 * @brief   Fill an area with a bitmap.
 * @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] srcx, srcy   The bitmap position to start the fill from
 * @param[in] srccx    The width of a line in the bitmap.
 * @param[in] buffer   The pixels to use to fill the area.
 *
 * @notapi
 */
void GDISP_LLD(blitareaex)(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer) {
    coord_t endx, endy;
    unsigned lg;

#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
    if (x < GDISP.clipx0) {
        cx -= GDISP.clipx0 - x;
        srcx += GDISP.clipx0 - x;
        x = GDISP.clipx0;
    }
    if (y < GDISP.clipy0) {
        cy -= GDISP.clipy0 - y;
        srcy += GDISP.clipy0 - y;
        y = GDISP.clipy0;
    }
    if (srcx+cx > srccx)		cx = srccx - srcx;
    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

    acquire_bus();
    set_viewport(x, y, cx, cy);
    stream_start();

    endx = srcx + cx;
    endy = y + cy;
    lg = srccx - cx;
    buffer += srcx + srcy * srccx;
    for(; y < endy; y++, buffer += lg)
        for(x=srcx; x < endx; x++)
            write_data(*buffer++);
    stream_stop();
    reset_viewport();
    release_bus();
}
开发者ID:omgmog,项目名称:olvfw,代码行数:48,代码来源:gdisp_lld.c

示例15: gdisp_lld_write_stop

	LLDSPEC	void gdisp_lld_write_stop(GDisplay *g) {
		release_bus(g);
	}
开发者ID:cosmikwolf,项目名称:ArduinoLibraries,代码行数:3,代码来源:gdisp_lld_SSD1327.c


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