コード例 #1
0
ファイル: GUI.c プロジェクト: jonathan-wu/xuanzhuandaolibai
//写入 单个字符
//在指定位置显示一个字符(8*12大小)
//dcolor为内容颜色,gbcolor为背静颜色
void showzifu(unsigned int x,unsigned int y,unsigned char value,unsigned int dcolor,unsigned int bgcolor)	
{  
    unsigned char i,j;
    unsigned int temp=0;    
    LCD_CS_0;
    Address_set(x,y,x+7,y+11);  //设置区域      
	                    
    temp+=(value-32)*12;   //确定要显示的值
                           //这里用的是ascii表  前32个ascii没有存入zifu库里 所以要减32
                           //并且 每个字符用12个字节显示 所以再乘以12  就是对应的显示位的首地址
    for(j=0;j<12;j++)
    {
        for(i=0;i<8;i++)		    //先横扫
        { 		     
                if((zifu[temp]&(1<<(7-i)))!=0)					//将1 左移 然后对应位进行相与 
                {
                    Lcd_Write_Data(dcolor);
                    //Draw_Point(x+i,y+j,dcolor);
                } 
                else
                {
                    Lcd_Write_Data(bgcolor);
                    //Draw_Point(x+i,y+j,bgcolor);
                }   
        }
        temp++;
     }
    LCD_CS_1;
}
コード例 #2
0
ファイル: GUI.c プロジェクト: jonathan-wu/xuanzhuandaolibai
void Draw_CC(unsigned int x,unsigned int y,unsigned char num, unsigned int dcolor, unsigned int bgcolor)//写汉字
{
  unsigned int i,j;
  LCD_CS_0;
  Address_set(x,y,x+16-1,y+16-1);
  for(  j=0; j<32 ; j++)
    for( i=0; i<8; i++)
    {
      if ((CC[num][j] & (1<<(7-i)))!=0)
        Lcd_Write_Data(dcolor);
      else
        Lcd_Write_Data(bgcolor);
    }
  LCD_CS_1;
}
コード例 #3
0
ファイル: GUI.c プロジェクト: jonathan-wu/xuanzhuandaolibai
void Draw_Point(unsigned int x,unsigned int y,unsigned int color)
{
  LCD_CS_0;
  Address_set(x,y,x,y);
  Lcd_Write_Data(color);
  LCD_CS_1;
}
コード例 #4
0
ファイル: GPIO_LCD1602.c プロジェクト: pedrominatel/embedded
/***************************************************************************//**
 * @brief   print a string on LCD1602.
 * @param[in] *string : point to the string which will be printed on LCD.
 ******************************************************************************/
void lcd_print (char *string)
{
    while (*string) 
    {
        Lcd_Write_Data (*string++);
    }
}
コード例 #5
0
ファイル: ILI9481.c プロジェクト: afester/CodeSamples
void tftDrawPixel(uint16_t x, uint16_t y) {
  CS_LOW;

  Address_set(x, y, x, y);
  Lcd_Write_Data(strokeColor >> 8);
  Lcd_Write_Data(strokeColor);

  CS_HIGH;
}
コード例 #6
0
ファイル: ILI9481.c プロジェクト: afester/CodeSamples
void tftBltMask(const uint8_t* source, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t col) {
    CS_LOW;

    const uint16_t* source16 = (const uint16_t*) source;

    Address_set(x, y, x+w-1, y+h-1);
    for(int i = 0; i < h; i++) {
      for(int m = 0; m < w; m++) { // x direction
        if (*source16++) {  // white pixel in mask gets background color



            Lcd_Write_Data(BLACK>>8);
            Lcd_Write_Data(BLACK);
        } else {            // non-white pixels in mask get given color
            Lcd_Write_Data(col>>8);
            Lcd_Write_Data(col);
        }
      }
コード例 #7
0
ファイル: ILI9481.c プロジェクト: afester/CodeSamples
void tftVLine(uint16_t x, uint16_t y, uint16_t l) {
  CS_LOW;

  Address_set(x, y, x, y+l-1);
  for(int i = 0; i < l; i++) {
      Lcd_Write_Data(strokeColor >> 8);
      Lcd_Write_Data(strokeColor);
  }

  CS_HIGH;
}
コード例 #8
0
ファイル: ILI9481.c プロジェクト: afester/CodeSamples
void Address_set(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2) {
  Lcd_Write_Com(0x2a);      // Set_column_address

  Lcd_Write_Data(x1>>8);    // MSB
  Lcd_Write_Data(x1);       // LSB

  Lcd_Write_Data(x2>>8);    // MSB
  Lcd_Write_Data(x2);       // LSB

  Lcd_Write_Com(0x2b);      // Set_page_address

  Lcd_Write_Data(y1>>8);    // MSB
  Lcd_Write_Data(y1);       // LSB

  Lcd_Write_Data(y2>>8);    // MSB
  Lcd_Write_Data(y2);       // LSB

  Lcd_Write_Com(0x2e);      // Write_memory_start
  Lcd_Write_Com(0x2c);      // Write_memory_start
}
コード例 #9
0
ファイル: lcd1602.c プロジェクト: zuzy/lumlink_STM8
void Lcd_Puts(unsigned char x,unsigned char y, unsigned char *str) //向1602写一个字符串 
{ 
   unsigned char * string = str;
   
   Lcd_SetXY(x,y); 
  
    while(*string) 
    { 
        Lcd_Write_Data(*string); 
        string++; 
    } 
}
コード例 #10
0
ファイル: TFT.c プロジェクト: jonathan-wu/test
//设置坐标范围		与tft驱动IC有关
void Address_set(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2)
{
  Lcd_Write_Com(0x0050);Lcd_Write_Data(x1);//0x0050~0x0053 windows control
  Lcd_Write_Com(0x0051);Lcd_Write_Data(x2);
  Lcd_Write_Com(0x0052);Lcd_Write_Data(y1);
  Lcd_Write_Com(0x0053);Lcd_Write_Data(y2);  
  Lcd_Write_Com(0x0020);Lcd_Write_Data(x1);	  
  Lcd_Write_Com(0x0021);Lcd_Write_Data(y1); 
  Lcd_Write_Com(0x0022);							 
}
コード例 #11
0
ファイル: GUI.c プロジェクト: jonathan-wu/xuanzhuandaolibai
void Fill_Window(unsigned int x1,unsigned int y1,unsigned int x2,unsigned int y2,unsigned int color)
{
  int i,j,it,jt;
  it=x2-x1;
  jt=y2-y1;
  LCD_CS_0;
  Address_set(x1,y1,x2,y2);
  for(i=0;i<=it;i++)
  {
    for (j=0;j<=jt;j++)
    {
      Lcd_Write_Data(color);
    }
  }
  LCD_CS_1;
}
コード例 #12
0
ファイル: ILI9481.c プロジェクト: afester/CodeSamples
void tftRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
  if (fill) {
     CS_LOW;
     Address_set(x, y, x+w-1, y+h-1);
     for(int i = 0; i < h; i++) {
       for(int m = 0; m < w; m++) {
         Lcd_Write_Data(fillColor >> 8);
         Lcd_Write_Data(fillColor);
       }
     }
     CS_LOW;
  }

  if (stroke) {
     tftHLine(x    , y    , w);
     tftHLine(x    , y+h-1, w);
     tftVLine(x    , y    , h);
     tftVLine(x+w-1, y    , h);
  }
}
コード例 #13
0
ファイル: TFT.c プロジェクト: jonathan-wu/test
void Lcd_Write_Com_Data(int com,int val)		   //发送数据命令
{
    Lcd_Write_Com(com);
    Lcd_Write_Data(val);
}
コード例 #14
0
ファイル: main.c プロジェクト: ohputra/stm32-tf
static msg_t put(void *ip, uint8_t chr) {
    (void)ip;
    Lcd_Write_Data(chr);
    return RDY_OK;
}
コード例 #15
0
ファイル: ILI9481.c プロジェクト: afester/CodeSamples
void tftInit() {
  configurePorts();

  RST_HIGH;
  _delay_ms(5);
  RST_LOW;
  _delay_ms(15);
  RST_HIGH;
  _delay_ms(15);

  CS_HIGH;
  WR_HIGH;

  CS_LOW;

  Lcd_Write_Com(0x11);  // Exit_sleep_mode
  _delay_ms(20);

  Lcd_Write_Com(0xD0);  // Power_Setting
  Lcd_Write_Data(0x07); // 0000 0111 - Vci1 = 1.0 * Vci
  Lcd_Write_Data(0x42); // 0100 0010 - PON (generate VLOUT3), VGL=3*Vci1
  Lcd_Write_Data(0x18); // 0001 1000 - VREG1OUT=Vci*1.95

  Lcd_Write_Com(0xD1);  // VCOM_Control
  Lcd_Write_Data(0x00); // 0000 0000 - select D1h for VCM setting
  Lcd_Write_Data(0x07); // 0000 0111 - VCOMH=0.72*VREG1OUT
  Lcd_Write_Data(0x10); // 0001 0000 - VCOM_ampl=VREGOUT1*1.02

  Lcd_Write_Com(0xD2);  // Power_Setting_for_normal_mode
  Lcd_Write_Data(0x01); // 0000 0001 - Gamma driver ampl. = Source driver ampl. = 1.0
  Lcd_Write_Data(0x02); // 0000 0010 - fDCDC2=Fosc/16 ; fDCDC1=Fosc/4

  Lcd_Write_Com(0xC0);  // Panel_driving_setting
  Lcd_Write_Data(0x10); // 0001 0000 - Grayscale inversion, gate driver pin arrangement
  Lcd_Write_Data(0x3B); // 0011 1011 - (value+1)*8 = number of lines to drive (59+1=60, 60*8=480)
  Lcd_Write_Data(0x00); // 0000 0000 - Scanning start position
                        // Missing parameter????? The following
                        // parameters are not consistent with the manual!
  Lcd_Write_Data(0x02); // 0000 0010 - ??????
  Lcd_Write_Data(0x11); // 0001 0001 - source output level in non-display area;

  Lcd_Write_Com(0xC5);  // Frame_rate_and_inversion_control
  Lcd_Write_Data(0x03); // 0000 0011 - Frame rate 72 Hz

// This is the most important register, since it sets the 
// way how the frame memory is set when it is written,
// and how the frame memory is mapped to the display panel
  Lcd_Write_Com(0x36);  // Set_address_mode
  Lcd_Write_Data(0b00101000);
                // |||||||+-- Vertical flip
                // ||||||+--- Horizontal flip
                // |||||+---- 0
                // ||||+----- Pixels sent in RGB order
                // |||+------ LCD refresh top to bottom
                // ||+------- Page/Column order
                // |+-------- Column address order left to right
                // +--------- Page address order top to bottom

  Lcd_Write_Com(0x3A);  // Set_pixel_format
  Lcd_Write_Data(0x55); // x101 x101 - 16 bit per pixel (65536 colors)

  Lcd_Write_Com(0x2A);  // Set_column_address
  Lcd_Write_Data(0x00); // 0000 0000
  Lcd_Write_Data(0x00); // 0000 0000 - Start column = 0
  Lcd_Write_Data(0x01); // 0000 0001
  Lcd_Write_Data(0x3F); // 0011 1111 - End column = 0x13F = 319

  Lcd_Write_Com(0x2B);  // Set_page_address
  Lcd_Write_Data(0x00); // 0000 0000
  Lcd_Write_Data(0x00); // 0000 0000 - Start page = 0
  Lcd_Write_Data(0x01); // 0000 0001
  Lcd_Write_Data(0xE0); // 1110 0000 - End page = 320 (???) (should be 1DF?)
  _delay_ms(120);

  Lcd_Write_Com(0x29);  // Set_display_on

  Lcd_Write_Com(0x2c);  // Write_memory_start
}