• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ release_bus函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: process_received_command

void process_received_command() {
  if (receivedBytes[0] == 0)
    return;

  // parse command and arg here
  const char cmd = receivedBytes[0];
  char* data = receivedBytes+2;

  if(debugMode == 1){
    //Serial.print("DEBUG Handling this command: ");
    //Serial.println(receivedBytes);
  }

  // d - toggle debugging output
  // h - take a hold on the bus so the cpu doesn't get confused
  // l - release bus and reset the cpu
  // m - set rom size
  // o - set rom offset
  // p - ping
  // r - read address
  // w - write data to address
  // z - zero out memory

  switch(cmd) {
    case 'p':
      Serial.println("OK");
      break;
    case 'z':
      zero_rom();
      Serial.println("OK");
      break;
    case 'o':
      set_rom_offset(cmd, data);
      Serial.println("OK");
      break;
    case 'm':
      set_rom_size(cmd, data);
      Serial.println("OK");
      break;
    case 'r':
      dump_memory_contents(cmd, data);
      Serial.println("OK");
      break;
    case 'd':
      toggle_debug();
      Serial.println("OK");
      break;
    case 'w':
      parse_hex_and_write_to_mem(cmd, data);
      Serial.println("OK");
      break;
    case 'h':
      hold_and_commandeer_bus();
      Serial.println("OK");
      break;
    case 'l':
      release_bus();
      reset_cpu();
      release_hold();
      Serial.println("OK");
      break;
    default:
      Serial.println("NOT OK");
      break;
  };

  clearReceivedCommand();
}
开发者ID:querry43,项目名称:8085,代码行数:68,代码来源:serial_interface.cpp


示例17: gdisp_lld_control

	LLDSPEC void gdisp_lld_control(GDisplay *g) {
		switch(g->p.x) {
		case GDISP_CONTROL_POWER:
			if (g->g.Powermode == (powermode_t)g->p.ptr)
				return;
			switch((powermode_t)g->p.ptr) {
				case powerOff:
					acquire_bus(g);
					write_reg(g, 0x07, 0x0000);
					write_reg(g, 0x10, 0x0000);
					write_reg(g, 0x11, 0x0000);
					write_reg(g, 0x12, 0x0000);
					write_reg(g, 0x13, 0x0000);
					release_bus(g);

					set_backlight(g, 0);
					break;

				case powerOn:
					//*************Power On sequence ******************//
					acquire_bus(g);
					write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
					write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
					write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
					write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
					gfxSleepMicroseconds(2000);            /* Dis-charge capacitor power voltage */
					write_reg(g, 0x10, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
					write_reg(g, 0x11, 0x0147); /* DC1[2:0], DC0[2:0], VC[2:0] */
					gfxSleepMicroseconds(500);
					write_reg(g, 0x12, 0x013C); /* VREG1OUT voltage */
					gfxSleepMicroseconds(500);
					write_reg(g, 0x13, 0x0E00); /* VDV[4:0] for VCOM amplitude */
					write_reg(g, 0x29, 0x0009); /* VCM[4:0] for VCOMH */
					gfxSleepMicroseconds(500);
					write_reg(g, 0x07, 0x0173); /* 262K color and display ON */
					release_bus(g);

					set_backlight(g, g->g.Backlight);
					break;

				case powerSleep:
					acquire_bus(g);
					write_reg(g, 0x07, 0x0000); /* display OFF */
					write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
					write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
					write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
					gfxSleepMicroseconds(2000); /* Dis-charge capacitor power voltage */
					write_reg(g, 0x10, 0x0002); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					release_bus(g);

					set_backlight(g, 0);
					break;

				case powerDeepSleep:
					acquire_bus(g);
					write_reg(g, 0x07, 0x0000); /* display OFF */
					write_reg(g, 0x10, 0x0000); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					write_reg(g, 0x11, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
					write_reg(g, 0x12, 0x0000); /* VREG1OUT voltage */
					write_reg(g, 0x13, 0x0000); /* VDV[4:0] for VCOM amplitude */
					gfxSleepMicroseconds(2000); /* Dis-charge capacitor power voltage */
					write_reg(g, 0x10, 0x0004); /* SAP, BT[3:0], APE, AP, DSTB, SLP */
					release_bus(g);

					set_backlight(g, 0);
					break;

				default:
					return;
				}
				g->g.Powermode = (powermode_t)g->p.ptr;
				return;

			case GDISP_CONTROL_ORIENTATION:
				if (g->g.Orientation == (orientation_t)g->p.ptr)
					return;
				switch((orientation_t)g->p.ptr) {
				case GDISP_ROTATE_0:
					acquire_bus(g);
					write_reg(g, 0x01, 0x0100);
					write_reg(g, 0x03, 0x1038);
					write_reg(g, 0x60, 0x2700);
					release_bus(g);

					g->g.Height = GDISP_SCREEN_HEIGHT;
					g->g.Width = GDISP_SCREEN_WIDTH;
					break;

				case GDISP_ROTATE_90:
					acquire_bus(g);
					write_reg(g, 0x01, 0x0000);
					write_reg(g, 0x03, 0x1030);
					write_reg(g, 0x60, 0x2700);
					release_bus(g);

					g->g.Height = GDISP_SCREEN_WIDTH;
					g->g.Width = GDISP_SCREEN_HEIGHT;
					break;

//.........这里部分代码省略.........
开发者ID:bunnie,项目名称:chibi-ugfx,代码行数:101,代码来源:gdisp_lld_R61505U.c


示例18: lld_gdisp_control

	/**
	 * @brief   Driver Control
	 * @details	Unsupported control codes are ignored.
	 * @note	The value parameter should always be typecast to (void *).
	 * @note	There are some predefined and some specific to the low level driver.
	 * @note	GDISP_CONTROL_POWER			- Takes a gdisp_powermode_t
	 * 			GDISP_CONTROL_ORIENTATION	- Takes a gdisp_orientation_t
	 * 			GDISP_CONTROL_BACKLIGHT -	 Takes an int from 0 to 100. For a driver
	 * 											that only supports off/on anything other
	 * 											than zero is on.
	 * 			GDISP_CONTROL_CONTRAST		- Takes an int from 0 to 100.
	 * 			GDISP_CONTROL_LLD			- Low level driver control constants start at
	 * 											this value.
	 *
	 * @param[in] what		What to do.
	 * @param[in] value		The value to use (always cast to a void *).
	 *
	 * @notapi
	 */
	void lld_gdisp_control(unsigned what, void *value) {
		switch(what) {
		case GDISP_CONTROL_POWER:
			if (GDISP.Powermode == (gdisp_powermode_t)value)
				return;
			switch((gdisp_powermode_t)value) {
			case powerOff:
				acquire_bus();
				write_reg(0x0010, 0x0000);	// leave sleep mode
				write_reg(0x0007, 0x0000);	// halt operation
				write_reg(0x0000, 0x0000);	// turn off oszillator
				write_reg(0x0010, 0x0001);	// enter sleepmode
				release_bus();
				break;
			case powerOn:
				acquire_bus();
				write_reg(0x0010, 0x0000);	// leave sleep mode
				release_bus();
				if (GDISP.Powermode != powerSleep)
					lld_gdisp_init();
				break;
			case powerSleep:
				acquire_bus();
				write_reg(0x0010, 0x0001);	// enter sleep mode
				release_bus();
				break;
			default:
				return;
			}
			GDISP.Powermode = (gdisp_powermode_t)value;
			return;
		case GDISP_CONTROL_ORIENTATION:
			if (GDISP.Orientation == (gdisp_orientation_t)value)
				return;
			switch((gdisp_orientation_t)value) {
			case GDISP_ROTATE_0:
				acquire_bus();
				write_reg(0x0001, 0x2B3F);
				/* ID = 11 AM = 0 */
				write_reg(0x0011, 0x6070);
				release_bus();
				GDISP.Height = GDISP_SCREEN_HEIGHT;
				GDISP.Width = GDISP_SCREEN_WIDTH;
				break;
			case GDISP_ROTATE_90:
				acquire_bus();
				write_reg(0x0001, 0x293F);
				/* ID = 11 AM = 1 */
				write_reg(0x0011, 0x6078);
				release_bus();
				GDISP.Height = GDISP_SCREEN_WIDTH;
				GDISP.Width = GDISP_SCREEN_HEIGHT;
				break;
			case GDISP_ROTATE_180:
				acquire_bus();
				write_reg(0x0001, 0x2B3F);
				/* ID = 01 AM = 0 */
				write_reg(0x0011, 0x6040);
				release_bus();
				GDISP.Height = GDISP_SCREEN_HEIGHT;
				GDISP.Width = GDISP_SCREEN_WIDTH;
				break;
			case GDISP_ROTATE_270:
				acquire_bus();
				write_reg(0x0001, 0x293F);
				/* ID = 01 AM = 1 */
				write_reg(0x0011, 0x6048);
				release_bus();
				GDISP.Height = GDISP_SCREEN_WIDTH;
				GDISP.Width = GDISP_SCREEN_HEIGHT;
				break;
			default:
				return;
			}
			#if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION
				GDISP.clipx0 = 0;
				GDISP.clipy0 = 0;
				GDISP.clipx1 = GDISP.Width;
				GDISP.clipy1 = GDISP.Height;
			#endif
			GDISP.Orientation = (gdisp_orientation_t)value;
//.........这里部分代码省略.........
开发者ID:etmatrix,项目名称:ChibiOS-GFX,代码行数:101,代码来源:gdisp_lld.c


示例19: gdisp_lld_control

	LLDSPEC void gdisp_lld_control(GDisplay *g) {
		switch(g->p.x) {
		#if 0
			case GDISP_CONTROL_POWER:
				if (g->g.Powermode == (powermode_t)g->p.ptr)
					return;
				switch((powermode_t)g->p.ptr) {
				case powerOff:
					acquire_bus(g);
					// TODO
					release_bus(g);
					break;
				case powerOn:
					acquire_bus(g);
					// TODO
					release_bus(g);
					break;
				case powerSleep:
					acquire_bus(g);
					// TODO
					release_bus(g);
					break;
				default:
					return;
				}
				g->g.Powermode = (powermode_t)g->p.ptr;
				return;
		#endif

		#if 0
			case GDISP_CONTROL_ORIENTATION:
				if (g->g.Orientation == (orientation_t)g->p.ptr)
					return;
				switch((orientation_t)g->p.ptr) {
				case GDISP_ROTATE_0:
					acquire_bus(g);
					// TODO
					release_bus(g);
					g->g.Height = GDISP_SCREEN_HEIGHT;
					g->g.Width = GDISP_SCREEN_WIDTH;
					break;
				case GDISP_ROTATE_90:
					acquire_bus(g);
					// TODO
					release_bus(g);
					g->g.Height = GDISP_SCREEN_WIDTH;
					g->g.Width = GDISP_SCREEN_HEIGHT;
					break;
				case GDISP_ROTATE_180:
					acquire_bus(g);
					// TODO
					release_bus(g);
					g->g.Height = GDISP_SCREEN_HEIGHT;
					g->g.Width = GDISP_SCREEN_WIDTH;
					break;
				case GDISP_ROTATE_270:
					acquire_bus(g);
					// TODO
					release_bus(g);
					g->g.Height = GDISP_SCREEN_WIDTH;
					g->g.Width = GDISP_SCREEN_HEIGHT;
					break;
				default:
					return;
				}
				g->g.Orientation = (orientation_t)g->p.ptr;
				return;
		#endif

        case GDISP_CONTROL_BACKLIGHT:
            if ((unsigned)g->p.ptr > 100)
            	g->p.ptr = (void *)100;
			acquire_bus(g);
            set_backlight(g, (unsigned)g->p.ptr);
			release_bus(g);
            g->g.Backlight = (unsigned)g->p.ptr;
            return;

		//case GDISP_CONTROL_CONTRAST:
        default:
            return;
		}
	}
开发者ID:bhdminh,项目名称:uGFX,代码行数:83,代码来源:gdisp_lld_RA8875.c


示例20: gdisp_lld_control

//	#error "SSD1327 - Hardware control is not supported yet"
LLDSPEC void gdisp_lld_control(GDisplay *g) {
  switch(g->p.x) {
  case GDISP_CONTROL_POWER:
    if (g->g.Powermode == (powermode_t)g->p.ptr)
      return;
    switch((powermode_t)g->p.ptr) {
    case powerOff:
      acquire_bus(g);
      write_cmd(g, SSD1327_SET_DISPLAY_MODE_ALL_OFF);
      release_bus();
      break;
    case powerSleep:
    case powerDeepSleep:
      acquire_bus(g);
      write_cmd(g, SSD1327_SET_SLEEP_ON);
      release_bus(g);
      break;
    case powerOn:
      acquire_bus(g);
      write_cmd(g, SSD1327_SET_SLEEP_OFF);
      write_cmd(g, SSD1327_SET_DISPLAY_MODE_ALL_ON);
      release_bus(g);
      break;
    default:
      return;
    }
    g->g.Powermode = (powermode_t)g->p.ptr;
    return;

  case GDISP_CONTROL_ORIENTATION:
    if (g->g.Orientation == (orientation_t)g->p.ptr)
      return;
    switch((orientation_t)g->p.ptr) {
    case GDISP_ROTATE_0: // correct
      acquire_bus(g);
      write_reg(g, SSD1327_SET_REMAP, (0b01<<6) | (1<<5) | (1<<4) | (1<<2) | 0b00);
      // bits:
      // [0] : address increment (0: horizontal, 1: vertical, reset 0)
      // [1] : column remap (0: 0..127, 1: 127..0, reset 0)
      // [2] : color remap (0: A->B->C, 1: C->B->A, reset 0)
      // [3] : reserved
      // [4] : column scan direction (0: top->down, 1: bottom->up, reset 0)
      // [5] : odd/even split COM (0: disable, 1: enable, reset 1)
      // [6..7] : color depth (00,01: 65k, 10: 262k, 11: 262k format 2)
      write_cmd(g, SSD1327_WRITE_RAM);
      g->g.Height = GDISP_SCREEN_HEIGHT;
      g->g.Width = GDISP_SCREEN_WIDTH;
      release_bus(g);
      break;
    case GDISP_ROTATE_90:
      acquire_bus(g);
      write_reg(g, SSD1327_SET_REMAP, (0b01<<6) | (1<<5) | (1<<4) | (1<<2) | 0b10);
      write_cmd(g, SSD1327_WRITE_RAM);
      g->g.Height = GDISP_SCREEN_WIDTH;
      g->g.Width = GDISP_SCREEN_HEIGHT;
      release_bus(g);
      break;
    case GDISP_ROTATE_180:
      acquire_bus(g);
      write_reg(g, SSD1327_SET_REMAP, (0b01<<6) | (1<<5) | (0<<4) | (1<<2) | 0b00);
      write_reg(g, SSD1327_SET_REMAP, 0b01100110);
      write_cmd(g, SSD1327_WRITE_RAM);
      g->g.Height = GDISP_SCREEN_HEIGHT;
      g->g.Width = GDISP_SCREEN_WIDTH;
      release_bus(g);
      break;
    case GDISP_ROTATE_270:
      acquire_bus(g);
      write_reg(g, SSD1327_SET_REMAP, (0b01<<6) | (1<<5) | (0<<4) | (1<<2) | 0b01);
      write_cmd(g, SSD1327_WRITE_RAM);
      g->g.Height = GDISP_SCREEN_WIDTH;
      g->g.Width = GDISP_SCREEN_HEIGHT;
      release_bus(g);
      break;
    default:
      return;
    }
    g->g.Orientation = (orientation_t)g->p.ptr;
    return;

  case GDISP_CONTROL_BACKLIGHT:
      if ((unsigned)g->p.ptr > 100)
        g->p.ptr = (void *)100;
      set_backlight(g, (unsigned)g->p.ptr);
      g->g.Backlight = (unsigned)g->p.ptr;
      return;

  //case GDISP_CONTROL_CONTRAST:
      default:
          return;
  }
}
开发者ID:cosmikwolf,项目名称:ArduinoLibraries,代码行数:93,代码来源:gdisp_lld_SSD1327.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ release_console_sem函数代码示例发布时间:2022-05-30
下一篇:
C++ release_buffer函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap