예제 #1
0
unsigned int erase_single_block(int dev, unsigned int addr)
{
	wr_cmd(dev, addr, XFL_CMD_BLOCK_ERASE_SETUP);
	wr_cmd(dev, addr, XFL_CMD_CONFIRM);

	return flash_wt_rdy(dev, addr);
}
예제 #2
0
void S6B33BG_ColorMode(COLOR_MODE color_mode) {

  wr_cmd(S6B33BG_ADDRESSING_MODE);
  wr_cmd(0x1B|color_mode);
  S6B33BG_color_mode=color_mode;

}
예제 #3
0
void S65L2F50::setArea(int_least16_t x0, int_least16_t y0, int_least16_t x1, int_least16_t y1)
{
  switch(lcd_orientation)
  {
    default:
    case 0:
      wr_cmd(0x15);                   //column address set 
      wr_dat(0x08+y0);                //start column
      wr_dat(0x01);                   //start column
      wr_dat(0x08+y1);                //end column
      wr_dat(0x01);                   //end column
      wr_cmd(0x75);                   //page address set 
      wr_dat(x0);                     //start page
      wr_dat(x1);                     //end page
      break;
    //case 90:
      //not implemented
    //  break;
    case 180:
      wr_cmd(0x15);                   //column address set 
      wr_dat(0x08+(LCD_HEIGHT-1)-y1); //start column
      wr_dat(0x01);                   //start column
      wr_dat(0x08+(LCD_HEIGHT-1)-y0); //end column
      wr_dat(0x01);                   //end column
      wr_cmd(0x75);                   //page address set 
      wr_dat(x0);                     //start page
      wr_dat(x1);                     //end page
      break;
    //case 270:
      //not implemented
    //  break;
  }

  return;
}
예제 #4
0
static void ili9341_set_window (unsigned short col_l,   // 
                                unsigned short col_h,	// col_l <= col_h < 320 --> x
								unsigned short row_l,	// row_l <= row_h < 240	--> y
								unsigned short row_h) {

/*
	0 ----------> X (max 319)
	|
	|
	|
	|
	Y (max 239)	
*/

	wr_cmd(0x2A);              // Collum area set  (collum max = 320)
	
	wr_dat((col_l>>8)& 0xFF);  // Colum high byte (lower collum)
	wr_dat(col_l & 0xFF);      // Colum low byte  (lower collum)

	wr_dat((col_h>>8)& 0xFF);  // Colum high byte (upper collum)
	wr_dat(col_h & 0xFF);      // Colum low byte  (upper collum)
    
		
	wr_cmd(0x2B);              // Row area set	  (row max = 240)

	wr_dat((row_l>>8)& 0xFF);  // Row high byte   (lower row)
	wr_dat(row_l & 0xFF);      // Row low byte    (lower row)

	wr_dat((row_h>>8)& 0xFF);  // Row high byte   (upper row)
	wr_dat(row_h & 0xFF);      // Row low byte    (upper row)
		  
	wr_cmd(0x2c);

}
예제 #5
0
파일: display.c 프로젝트: cnvogelg/knobterm
void display_set_orientation(u08 o)
{
    switch(o)
    {
        case DISPLAY_ORIENTATION_0:
        display_orientation = DISPLAY_ORIENTATION_0;
        display_width  = 320;
        display_height = 240;
        wr_cmd(0x16, 0x00A8); //MY=1 MX=0 MV=1 ML=0 BGR=1
        break;

        case DISPLAY_ORIENTATION_90:
        display_orientation = DISPLAY_ORIENTATION_90;
        display_width  = 240;
        display_height = 320;
        wr_cmd(0x16, 0x0008); //MY=0 MX=0 MV=0 ML=0 BGR=1
        break;

        case DISPLAY_ORIENTATION_180:
        display_orientation = DISPLAY_ORIENTATION_180;
        display_width  = 320;
        display_height = 240;
        wr_cmd(0x16, 0x0068); //MY=0 MX=1 MV=1 ML=0 BGR=1
        break;

        case DISPLAY_ORIENTATION_270:
        display_orientation = DISPLAY_ORIENTATION_270;
        display_width  = 240;
        display_height = 320;
        wr_cmd(0x16, 0x00C8); //MY=1 MX=0 MV=1 ML=0 BGR=1
        break;
    }

    display_set_area(0, 0, display_width-1, display_height-1);
}
예제 #6
0
void lock_single_block(int dev, unsigned int addr)
{
	char status;

	do
	{
		wr_cmd(dev, addr, XFL_CMD_BLOCK_LOCK_SETUP);
		wr_cmd(dev, addr, XFL_CMD_BLOCK_LOCK_CONFIRM);
		status = rd_cmd(dev, addr + 2, XFL_CMD_READ_ELEC_SIG);
	}
	while (status == 0);
}
예제 #7
0
void MI0283QT9::setArea(int_least16_t x0, int_least16_t y0, int_least16_t x1, int_least16_t y1)
{
  wr_cmd(LCD_CMD_COLUMN);
  wr_data16(x0);
  wr_data16(x1);

  wr_cmd(LCD_CMD_PAGE);
  wr_data16(y0);
  wr_data16(y1);

  return;
}
예제 #8
0
파일: display.c 프로젝트: cnvogelg/knobterm
void display_enable(u08 on)
{
  if(on) {
    wr_cmd(0x28, 0x0038);
    _delay_ms(40);
    wr_cmd(0x28, 0x003C);  
  } else {
    wr_cmd(0x28, 0x0038);
    _delay_ms(40);
    wr_cmd(0x28, 0x0004);
  }
}
void S65LS020::setOrientation(uint_least16_t o)
{
  uint_least8_t p1, p5;

       if((o ==   9) || 
          (o ==  90))
  {
    lcd_orientation = 90;
    lcd_width  = LCD_HEIGHT;
    lcd_height = LCD_WIDTH;
    p1 = 0x00; //x0->x1, y0->y1
    p5 = 0x00; //0x04=rotate, 0x00=normal
  }

  else if((o ==  18) || 
          (o == 180))
  {
    lcd_orientation = 180;
    lcd_width  = LCD_WIDTH;
    lcd_height = LCD_HEIGHT;
    p1 = 0x80; //x0->x1, y1->y0
    p5 = 0x04; //0x04=rotate, 0x00=normal
  }

  else if((o ==  27) || 
          (o ==  14) || 
          (o == 270))
  {
    lcd_orientation = 270;
    lcd_width  = LCD_HEIGHT;
    lcd_height = LCD_WIDTH;
    p1 = 0xC0; //x1->x0, y1->y0
    p5 = 0x00; //0x04=rotate, 0x00=normal
  }

  else
  {
    lcd_orientation = 0;
    lcd_width  = LCD_WIDTH;
    lcd_height = LCD_HEIGHT;
    p1 = 0x40; //x1->x0, y0->y1
    p5 = 0x04; //0x04=rotate, 0x00=normal
  }

  wr_cmd(0xEF, 0x90);
  wr_cmd(0x01, p1);
  wr_cmd(0x05, p5);

  setArea(0, 0, lcd_width-1, lcd_height-1);

  return;
}
예제 #10
0
void MI0283QT9::invertDisplay(uint_least8_t invert)
{
  if(invert == 0)
  {
     wr_cmd(LCD_CMD_INV_OFF);
  }
  else
  {
     wr_cmd(LCD_CMD_INV_ON);
  }

  return;
}
예제 #11
0
void NokiaN70_SetWindow(uint16_t x0,uint16_t y0,uint16_t x1,uint16_t y1) {

  wr_cmd(COLUMN_ADDRESS_SET);
  wr_dat(x0>>8);
  wr_dat(x0);
  wr_dat(x1>>8);
  wr_dat(x1);

  wr_cmd(PAGE_ADDRESS_SET);
  wr_dat(y0>>8);
  wr_dat(y0);
  wr_dat(y1>>8);
  wr_dat(y1);
}
예제 #12
0
unsigned int wr_data_B(int dev, unsigned int addr, char data)
{
	wr_cmd(dev, addr, XFL_CMD_PROGRAM_SETUP);
	wr_byte(dev, addr, data);

	return flash_wt_rdy(dev, addr);
}
예제 #13
0
void NokiaN70_PartialArea(uint16_t y0,uint16_t y1) {
  wr_cmd(PARTIAL_AREA);
  wr_dat(y0>>8);
  wr_dat(y0);
  wr_dat(y1>>8);
  wr_dat(y1);
}
예제 #14
0
void SPI_TFT_ILI9341::window (unsigned int x, unsigned int y, unsigned int w, unsigned int h)
{
    wr_cmd(0x2A);
    SPI::write(x >> 8);
    SPI::write(x);
    SPI::write((x+w-1) >> 8);
    SPI::write(x+w-1);
    
    _cs = 1;
    wr_cmd(0x2B);
    SPI::write(y >> 8);
    SPI::write(y);
    SPI::write((y+h-1) >> 8);
    SPI::write(y+h-1);
    _cs = 1;
}
예제 #15
0
static __inline void wr_reg (unsigned char reg, unsigned short val) {

  	Clr_Cs;
	wr_cmd(reg);      
	wr_dat(val);    
	Set_Cs; 
}
예제 #16
0
파일: lcd.c 프로젝트: epffpe/Atmel
static inline void wr_reg (unsigned char reg, unsigned short val) {

  LCD_CS(0)
  wr_cmd(reg);
  wr_dat(val);
  LCD_CS(1)
}
예제 #17
0
파일: lcd.c 프로젝트: epffpe/Atmel
void GLCD_DrawChar (unsigned int x, unsigned int y, unsigned short *c) {
  int idx = 0, i, j;

  x = WIDTH-x-CHAR_W;
  wr_reg(0x50, y);                      /* Horizontal GRAM Start Address      */
  wr_reg(0x51, y+CHAR_H-1);             /* Horizontal GRAM End   Address (-1) */
  wr_reg(0x52, x);                      /* Vertical   GRAM Start Address      */
  wr_reg(0x53, x+CHAR_W-1);             /* Vertical   GRAM End   Address (-1) */

  wr_reg(0x20, y);
  wr_reg(0x21, x);
  LCD_CS(0)
  wr_cmd(0x22);
  wr_dat_start();
  for (j = 0; j < CHAR_H; j++) {
    for (i = CHAR_W-1; i >= 0; i--) {
      if((c[idx] & (1 << i)) == 0x00) {
        wr_dat_only(BackColor);
      } else {
        wr_dat_only(TextColor);
      }
    }
    c++;
  }
  wr_dat_stop();
}
예제 #18
0
파일: lcd.c 프로젝트: epffpe/Atmel
void GLCD_Bargraph (unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int val) {
  int i,j;

  x = WIDTH-x-w;
  wr_reg(0x50, y);                      /* Horizontal GRAM Start Address      */
  wr_reg(0x51, y+CHAR_H-1);             /* Horizontal GRAM End   Address (-1) */
  wr_reg(0x52, x);                      /* Vertical   GRAM Start Address      */
  wr_reg(0x53, x+w-1);                  /* Vertical   GRAM End   Address (-1) */

  val = (val * w) >> 10;                /* Scale value for 24x12 characters   */
  wr_reg(0x20, y);
  wr_reg(0x21, x);
  LCD_CS(0)
  wr_cmd(0x22);
  wr_dat_start();
  for (i = 0; i < h; i++) {
    for (j = w-1; j >= 0; j--) {
      if(j >= val) {
        wr_dat_only(BackColor);
      } else {
        wr_dat_only(TextColor);
      }
    }
  }
  wr_dat_stop();
}
예제 #19
0
void S65LS020::invertDisplay(uint_least8_t invert)
{
  wr_cmd(0xEF, 0xB0);
  if(invert == 0)
  {
    wr_cmd(0x49, 0x02);
  }
  else
  {
    wr_cmd(0x49, 0x03);
  }
  wr_cmd(0xEF, 0x90);
  wr_cmd(0x00, 0x00);

  return;
}
예제 #20
0
void GLCD_bitmap (unsigned int x, unsigned int y, unsigned int w, unsigned int h, const unsigned short *bitmap) {
  unsigned int   i;
  unsigned int   len = w*h;
  const unsigned short *bitmap_ptr = (const unsigned short *)bitmap;

#ifdef ILI9341
  ili9341_set_window (x, x + w-1, y, y + h - 1);
  for (i = 0; i < len; i++) {
    wr_dat(*bitmap_ptr++);
  }
#else
  wr_reg(0x50, y);                      /* Horizontal GRAM Start Address      */
  wr_reg(0x51, y+h-1);                  /* Horizontal GRAM End   Address (-1) */
  wr_reg(0x52, x);                      /* Vertical   GRAM Start Address      */
  wr_reg(0x53, x+w-1);                  /* Vertical   GRAM End   Address (-1) */

  wr_reg(0x20, y);
  wr_reg(0x21, x);

  Clr_Cs;
  wr_cmd(0x22);
  for (i = 0; i < len; i++) {
    wr_dat(*bitmap_ptr++);
  }
  Set_Cs;
#endif
}
예제 #21
0
uint8_t NokiaN70_Init(uint8_t AddressSetupTime,uint8_t DataSetupTime) {

  GPIO_Configuration();
  FSMC_LCD_Init(AddressSetupTime,DataSetupTime);

  lcd_rst();

  wr_cmd(SLEEP_OUT);
  wr_cmd(DISPLAY_INVERSION_OFF);
  wr_cmd(IDLE_MODE_OFF);
  wr_cmd(NORMAL_DISPLAY_MODE_ON);
  DWT_Delay(125000);
  wr_cmd(DISPLAY_ON);

  return NokiaN70_OK;
}
예제 #22
0
void TFT_ILI9325::fill(int x, int y, int w, int h, uint16_t color) {
	uint32_t i, size;
	uint8_t *blk;

	// alloc memory
	blk = new uint8_t[TFT_BLK_SIZE + 1];
	size = (LCD_WIDTH * LCD_HEIGHT) * 2;

	// fill color
	blk[0] = SSP_START | SSP_WR | SSP_DATA;
	for (i = 0; i < TFT_BLK_SIZE && i < size; i += 2) {
		blk[i + 1] = color >> 8;
		blk[i + 2] = color & 0xFF;
	}

	CThread::suspendAll();

	// write to tft-lcd
	setWindow(x, y, w, h);

	wr_cmd(0x22);
	do {
		spi.readwrite(blk, NULL, TFT_BLK_SIZE + 1);
		size -= TFT_BLK_SIZE;
	} while (size > 0);

	CThread::resumeAll();
	delete blk;
}
예제 #23
0
void MI0283QT9::drawStart(void)
{
  wr_cmd(LCD_CMD_WRITE);
  CS_ENABLE();

  return;
}
예제 #24
0
/*******************************************************************************
* Draw character on given position (line, coloum                               *
*   Parameter:     x :        horizontal position                              *
*                  y :        vertical position                                *
*                  c*:        pointer to color value                           *
*   Return:                                                                    *
*******************************************************************************/
void GLCD_drawChar(unsigned int x, unsigned int y, unsigned short *c) {
    unsigned int index = 0;
    int  i = 0;
    unsigned int Xaddress = 0;

    Xaddress = x;

    wr_reg(0x20, Xaddress);
    wr_reg(0x21, y);

    for(index = 0; index < 24; index++)
    {
        wr_cmd(0x22);              /* Prepare to write GRAM */
        for(i = 15; i >= 0; i--)
//    for(i = 0; i < 16; i++)
        {
            if((c[index] & (1 << i)) == 0x00) {
                wr_dat(BackColor);
            } else {
                wr_dat(TextColor);
            }
        }
        Xaddress++;
        wr_reg(0x20, Xaddress);
        wr_reg(0x21, y);
    }
}
예제 #25
0
void TFT_ILI9325::bitmap(int x, int y, int w, int h, const void *bmp) {
	uint32_t len = w * h;

	setWindow(x, y, w, h);

	wr_cmd(0x22);
	wr_bmp((uint8_t *) bmp, len * 2);
}
예제 #26
0
void S65L2F50::drawStart(void)
{
  wr_cmd(0x5C);
  RS_DISABLE(); //data
  CS_ENABLE();

  return;
}
예제 #27
0
static unsigned short rd_reg (unsigned short reg) {

  	Clr_Cs;
	wr_cmd(reg);     
	reg = rd_dat();      	
	Set_Cs;
	return reg;
}
예제 #28
0
/*******************************************************************************
* Draw character on given position (line, coloum                               *
*   Parameter:     x :        horizontal position                              *
*                  y :        vertical position                                *
*                  c*:        pointer to color value                           *
*   Return:                                                                    *
*******************************************************************************/
void GLCD_drawChar(unsigned int x, unsigned int y, unsigned short *c) {

#ifdef ILI9341

  unsigned int index = 0;
  int  i = 0;

  ili9341_set_window (y, y + 15, x, x + 23);  

  for(index = 0; index < 24; index++)
  {
    for(i = 0; i < 16; i++)
    {
      if((c[index] & (1 << i)) == 0x00) {
         wr_dat(BackColor);
      } else {
         wr_dat(TextColor);
      }
    }
  } 	

#else /* ILI9341 */

  unsigned int index = 0;
  int  i = 0;
  unsigned int Xaddress = 0;   

  Xaddress = x;

  wr_reg(0x21, y);
  wr_reg(0x20, Xaddress);


  for(index = 0; index < 24; index++)
  {
  	Clr_Cs;
    wr_cmd(0x22);              /* Prepare to write GRAM */

    for(i = 0; i <= 15; i++)
    {
      if((c[index] & (1 << i)) == 0x00) {
         wr_dat(BackColor);
      } else {
         wr_dat(TextColor);
      }
    }

	Set_Cs;

    Xaddress++;

	wr_reg(0x21, y);
    wr_reg(0x20, Xaddress);
  }

#endif /* ILI9341 */

}
예제 #29
0
파일: lcd.c 프로젝트: epffpe/Atmel
void GLCD_PutPixel (unsigned int x, unsigned int y) {

  wr_reg(0x20, y);
  wr_reg(0x21, WIDTH-1-x);
  LCD_CS(0)
  wr_cmd(0x22);
  wr_dat(TextColor);
  LCD_CS(1)
}
예제 #30
0
void GLCD_clear (unsigned short color) {
    unsigned int   i;

    wr_reg(0x20, 0);
    wr_reg(0x21, 0);
    wr_cmd(0x22);
    for(i = 0; i < (WIDTH*HEIGHT); i++)
        wr_dat(color);
}