Example #1
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  lcdInit();

/*
// code from mikorcontroller.net graphics example with jpg pic:
  uint16_t x;
  uint8_t y;
  uint8_t r,g,b;
  lcd_area(0, 0, (LCD_WIDTH-1), (LCD_HEIGHT-1));
  lcd_drawstart();
  for(y = 0; y < LCD_HEIGHT; y++)
  {
    for(x = 0; x < LCD_WIDTH; x++)
    {
      r = x + y;
      g = x - y;
      b = y - x;
      lcd_draw(RGB(r,g,b));
    }
  }
  lcd_drawstop();
*/


// mk
  lcd_area(1, 1, 20, 20);
  lcd_drawstart();
  lcd_draw(COLOR_BLACK);
  lcd_drawstop();
  
}
void s_setup_menu_draw(void)
{
    int i;
    int16_t font, back;
    
    for (i = 0; i < 2; i++) {
        if (menu_index == i) {
            font = BLACK;
            back = WHITE;
        }
        else {
            font = WHITE;
            back = BLACK;
        }
        lcd_area(24, 19 + i * 9, 9, 30, back);
        lcd_string(s_setup_menu[i], 25, 20 + i * 9, 1, font, back);
    }
}
Example #3
0
void lcd_clear(unsigned int color)
{
  unsigned int i;

  lcd_area(0, 0, (LCD_WIDTH-1), (LCD_HEIGHT-1));

  lcd_drawstart();
  for(i=(LCD_WIDTH*LCD_HEIGHT/8); i!=0; i--)
  {
    lcd_draw(color); //1
    lcd_draw(color); //2
    lcd_draw(color); //3
    lcd_draw(color); //4
    lcd_draw(color); //5
    lcd_draw(color); //6
    lcd_draw(color); //7
    lcd_draw(color); //8
  }
  lcd_drawstop();

  return;
}
void s_setup_root_draw(void)
{
    lcd_area(24, 0, 9, 30, BLUE);
    lcd_string("SETUP", 25, 1, 1, WHITE, BLUE);
}
Example #5
0
File: bmp.c Project: Rainaldo/mSdk
static bool fill_frame_buffer(tDisplay *pDisplay, struct bm_info_header_s *bm_info_header, /*put_str_t *BmpLimits,*/ unsigned char* data_start, signed short X, signed short Y, unsigned char SourceMemory)
{

	unsigned int k = 0,l = 0;
	unsigned char  *bm = data_start;
//	unsigned char red = 0,green = 0,blue = 0;
	signed short X_Coordinate = 0;
	signed short Y_Coordinate = 0;
	unsigned int Tmp2 = bm_info_header->biWidth&0x3;
	unsigned int Tmp3 = (0 - ((unsigned char)bm_info_header->biWidth &0x3)) & 0x3;
	volatile unsigned short BitCount = bm_info_header->biBitCount;
	unsigned int Temp;
	unsigned int  *mask;
	unsigned int BitColourUsed;
	//struct rgb_8 color;
	unsigned int color;
	switch(BitCount)
	{
		case(32):
		case(24):
#ifdef LcdArea_Integrated
			lcd_area(X, Y, X+bm_info_header->biWidth-1, Y+bm_info_header->biHeight-1);
			lcd_drawstart();
#endif
			Y_Coordinate = Y;
			if(bm_info_header->biHeight > 0)
			{
				bm += ((BitCount * bm_info_header->biWidth * (bm_info_header->biHeight - 1)) / 8);//    (((bm_info_header->biWidth) * (Y+bm_info_header->biHeight-1)) * BitCount >> 3) - ((bm_info_header->biWidth-1) * BitCount >> 3) ;
				bm += Tmp2*(bm_info_header->biHeight - 1);
			}
			for (l = 0 ; l < bm_info_header->biHeight; l++)
			{
				X_Coordinate = X;
				for (k = 0; k < bm_info_header->biWidth; k++)
				{
#ifdef Dx_UseMarginLimits
#ifndef LcdArea_Integrated
					if(X_Coordinate >= BmpLimits->LeftEdgeLimit && X_Coordinate <= (BmpLimits->LeftEdgeLimit + BmpLimits->RightEdgeLimit) && Y_Coordinate >= BmpLimits->UpEdgeLimit && Y_Coordinate <= (BmpLimits->UpEdgeLimit + BmpLimits->DownEdgeLimit))
					{
#endif
#endif
						//color.red = (*bm);// >> 3;
						//color.green = (*(bm +1));// >> 2;
						//color.blue = (*(bm + 2));// >> 3;
						color = RGB_TO_UINT((*bm), (*(bm +1)), (*(bm + 2)));
#ifdef LcdArea_Integrated
						unsigned short TempColor = ((red>>3)&0b11111) | ((green<<3)&0b11111100000) | ((blue<<8)&0b1111100000000000);
						lcd_rw_data(TempColor);
#else
						//pContext->ulForeground = color;
						put_pixel(pDisplay, X_Coordinate,Y_Coordinate, color);
#endif
#ifdef Dx_UseMarginLimits
#ifndef LcdArea_Integrated
					}
#endif
#endif
					X_Coordinate++;
					bm += BitCount >> 3;
				}
				Y_Coordinate++;
				if(bm_info_header->biHeight < 0)
				{
					if(BitCount == 24)
					{
						bm += Tmp2;
					}
				}
				else
				{
					if(BitCount == 24)
					{
						bm -= Tmp2;
					}
					bm -= BitCount * 2 * bm_info_header->biWidth / 8;//bm_info_header->biBitCount *2* bm_info_header->biWidth / 8;
				}
			}
#ifdef LcdArea_Integrated
			lcd_drawstop();
#endif
			break;
		case(8):
			Y_Coordinate = Y;
			BitColourUsed = bm_info_header->biClrUsed;
			if ((unsigned char)bm_info_header->biClrUsed == 0)
			{
				BitColourUsed = 256;
			}
			Temp = 0;
			mask = (unsigned int*)(bm - (BitColourUsed * 4));
			if(bm_info_header->biHeight > 0)
			{
				bm += (bm_info_header->biWidth - 1) * (bm_info_header->biHeight - 1);//    (((bm_info_header->biWidth) * (Y+bm_info_header->biHeight-1)) * BitCount >> 3) - ((bm_info_header->biWidth-1) * BitCount >> 3) ;
				bm += ((Tmp3 & 0x3)+1) * (bm_info_header->biHeight - 1);
			}
			//if(SourceMemory == BMP_FromFileSystemMemory)
			//{
			//	_FatData_GoToIndex(fileinfo, (unsigned int)(unsigned short)bm);
			///	memcpy(IndexBuffer, fileinfo->FileInfo_BufferAddr, 512);
			//	memcpy(DataBuffer, fileinfo->FileInfo_BufferAddr, 512);
			//}
#ifdef LcdArea_Integrated
			lcd_area(X, Y, (X+bm_info_header->biWidth), (Y+bm_info_header->biHeight-1));
			lcd_drawstart();
#endif
			for (l = 0 ; l < bm_info_header->biHeight; l++)
			{
				X_Coordinate = X;
				for (k = 0; k <= bm_info_header->biWidth; k++)
				{
#ifdef Dx_UseMarginLimits
#ifdef Dx_UseMarginLimits
					if(X_Coordinate >= BmpLimits->LeftEdgeLimit && X_Coordinate <= (BmpLimits->LeftEdgeLimit + BmpLimits->RightEdgeLimit) && Y_Coordinate >= BmpLimits->UpEdgeLimit && Y_Coordinate <= (BmpLimits->UpEdgeLimit + BmpLimits->DownEdgeLimit))
					{
#endif
#endif
						Temp = *bm;
						Temp = Temp<<2;
						//color.red = *(mask + Temp);
						//color.green = *(mask + Temp + 1);
						//color.blue = *(mask + Temp + 2);
						color = RGB_TO_UINT(*(mask + Temp), *(mask + Temp + 1), *(mask + Temp + 2));
#ifdef LcdArea_Integrated
						unsigned short TempColor = ((blue>>3)&0b11111) | ((green<<3)&0b11111100000) | ((red<<8)&0b1111100000000000);
						lcd_rw_data(TempColor);
#else
						//pContext->ulForeground = color;
						put_pixel(pDisplay, X_Coordinate,Y_Coordinate, color);
#endif
#ifdef Dx_UseMarginLimits
#ifdef Dx_UseMarginLimits
					}
#endif
#endif
					X_Coordinate++;
					bm++;
				}
				Y_Coordinate++;
				if(bm_info_header->biHeight < 0) bm += Tmp3;
				else
				{
					bm -= Tmp3+1;
					bm -= 2 * bm_info_header->biWidth;
				}


				//bm += Tmp3;
			}