示例#1
0
void write_buffer(uint8_t *buffer) {
  uint8_t c, p;

  for(p = 0; p < 8; p++) {
    /*
      putstring("new page! ");
      uart_putw_dec(p);
      putstring_nl("");
    */

    st7565_command(CMD_SET_PAGE | pagemap[p]);
    st7565_command(CMD_SET_COLUMN_LOWER | (0x0 & 0xf));
    st7565_command(CMD_SET_COLUMN_UPPER | ((0x0 >> 4) & 0xf));
    st7565_command(CMD_RMW);
    st7565_data(0xff);
    
    //st7565_data(0x80);
    //continue;
    
    for(c = 0; c < 128; c++) {
      //uart_putw_dec(c);
      //uart_putchar(' ');
      st7565_data(buffer[(128*p)+c]);
    }
  }
}
示例#2
0
void write_buffer(uint8_t *buffer) 
{
  uint8_t c, p;
  for(p = 0; p < 8; p++) 
  {
    st7565_command(CMD_SET_PAGE | pagemap[p]);
    st7565_command(CMD_SET_COLUMN_LOWER | (0x0 & 0xf));
    st7565_command(CMD_SET_COLUMN_UPPER | ((0x0 >> 4) & 0xf));
    st7565_command(CMD_RMW);
    st7565_data(0xff); 
    for(c = 0; c < 128; c++) 
      st7565_data(buffer[(128*p)+c]);
  }
}
示例#3
0
void ST7565::display(void) {
  uint8_t col, maxcol, p;

  /*
  Serial.print("Refresh ("); Serial.print(xUpdateMin, DEC); 
  Serial.print(", "); Serial.print(xUpdateMax, DEC);
  Serial.print(","); Serial.print(yUpdateMin, DEC); 
  Serial.print(", "); Serial.print(yUpdateMax, DEC); Serial.println(")");
  */

  for(p = 0; p < 8; p++) {
    /*
      putstring("new page! ");
      uart_putw_dec(p);
      putstring_nl("");
    */
#ifdef enablePartialUpdate
    // check if this page is part of update
    if ( yUpdateMin >= ((p+1)*8) ) {
      continue;   // nope, skip it!
    }
    if (yUpdateMax < p*8) {
      break;
    }
#endif

    st7565_command(CMD_SET_PAGE | pagemap[p]);


#ifdef enablePartialUpdate
    col = xUpdateMin;
    maxcol = xUpdateMax;
#else
    // start at the beginning of the row
    col = 0;
    maxcol = LCDWIDTH-1;
#endif

    st7565_command(CMD_SET_COLUMN_LOWER | ((col+ST7565_STARTBYTES) & 0xf));
    st7565_command(CMD_SET_COLUMN_UPPER | (((col+ST7565_STARTBYTES) >> 4) & 0x0F));
    st7565_command(CMD_RMW);
    
    for(; col <= maxcol; col++) {
      //uart_putw_dec(col);
      //uart_putchar(' ');
      st7565_data(st7565_buffer[(128*p)+col]);
    }
  }

#ifdef enablePartialUpdate
  xUpdateMin = LCDWIDTH - 1;
  xUpdateMax = 0;
  yUpdateMin = LCDHEIGHT-1;
  yUpdateMax = 0;
#endif
}
示例#4
0
void clear_screen(void) {
  uint8_t p, c;
  for(p = 0; p < 8; p++) {
    st7565_command(CMD_SET_PAGE | p);
    for(c = 0; c < 129; c++) {
      st7565_command(CMD_SET_COLUMN_LOWER | (c & 0xf));
      st7565_command(CMD_SET_COLUMN_UPPER | ((c >> 4) & 0xf));
      st7565_data(0x0);
    }     
  }
}
示例#5
0
void clear_screen(void)
{
    uint8_t p, c;
    for(p = 0; p < 4; p++)
    {
        st7565_command(CMD_SET_PAGE | p);
        st7565_command(CMD_SET_COLUMN_UPPER);
        st7565_command(CMD_SET_COLUMN_LOWER);
        for(c = 0; c < 128; c++)
        {
            st7565_data(0x0);
        }
    }
}
// Clear screen (does not clear buffer)
void clear_screen(void)
{
	uint8_t p, c;

	for(p = 0; p < 8; p++)
	{
		st7565_command(CMD_SET_PAGE | p);								// Set page to p
		for(c = 0; c < 128; c++) 										// Was 129, which I think is wrong...
		{
			st7565_command(CMD_SET_COLUMN_LOWER | (c & 0xf));
			st7565_command(CMD_SET_COLUMN_UPPER | ((c >> 4) & 0xf));	// Set column to c
			st7565_data(0x00);											// Clear data
		}
	}
}
// Write LCD buffer if type = 1 normal, 0 = logo.
void write_buffer(uint8_t *buffer, uint8_t type) 
{
	uint8_t c, p;
	for(p = 0; p < 8; p++) 
	{
		st7565_command(CMD_SET_PAGE | (uint8_t)pgm_read_byte(&pagemap[p]));		// Page 7 to 0
		st7565_command(CMD_SET_COLUMN_LOWER | (0x0 & 0xf));						// Column 0
		st7565_command(CMD_SET_COLUMN_UPPER | ((0x0 >> 4) & 0xf));				// Column 0
		st7565_command(CMD_RMW);												// Sets auto-increment

		for(c = 0; c < 128; c++) 
		{
			st7565_data(buffer[(128*p)+c]);
		}
	}
}
示例#8
0
文件: ST7565.c 项目: littlevgl/hw
/**
 * Flush a specific part of the buffer to the display
 * @param x1 left coordinate of the area to flush
 * @param y1 top coordinate of the area to flush
 * @param x2 right coordinate of the area to flush
 * @param y2 bottom coordinate of the area to flush
 */
static void st7565_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
{
    spi_cs_en(ST7565_DRV);   
    
    uint8_t c, p;
    for(p = y1 / 8; p <= y2 / 8; p++) {
        st7565_command(CMD_SET_PAGE | pagemap[p]);
        st7565_command(CMD_SET_COLUMN_LOWER | (x1 & 0xf));
        st7565_command(CMD_SET_COLUMN_UPPER | ((x1 >> 4) & 0xf));
        st7565_command(CMD_RMW);
  
         for(c = x1; c <= x2; c++) {
            st7565_data(lcd_fb[(ST7565_HOR_RES*p)+c]);
        }
    }
    
  spi_cs_dis(ST7565_DRV);   
}
示例#9
0
// this doesnt touch the buffer, just clears the display RAM - might be handy
void ST7565::clear_display(void) {
  uint8_t p, c;
  
  for(p = 0; p < 8; p++) {
    /*
      putstring("new page! ");
      uart_putw_dec(p);
      putstring_nl("");
    */

    st7565_command(CMD_SET_PAGE | p);
    for(c = 0; c < 129; c++) {
      //uart_putw_dec(c);
      //uart_putchar(' ');
      st7565_command(CMD_SET_COLUMN_LOWER | (c & 0xf));
      st7565_command(CMD_SET_COLUMN_UPPER | ((c >> 4) & 0xf));
      st7565_data(0x0);
    }     
  }
}