Tuesday, September 11, 2018

SSD1331 OLED

This display has the driver SSD1331 this one is a RGB OLED display, 65K color and SPI interface. So, our ili9341 driver was adapted to this display.
Request.
Email contact: armicrocontroller@gmail.com

Video. 

Description of library.
This function initializes the driver SSD1331.
SSD1331_Init(void)
Example:
SSD1331_Init();


This function resets the driver SSD1331.
SSD1331_Reset(void)
Example:
SSD1331_Reset();


This function draws a pixel.
SSD1331_Pixel(x, y, color)

  • x: x position. Valid values: 0..96
  • y: y position. Valid values: 0..64
  • color: color parameter.
Example:
SSD1331_Pixel(50, 50, BLUE);


This function sets the size of dot.
SSD1331_SetDotSize(size)

  • size: Size of dot. Valid values: 0, 1, 2, 3, 4, 5.
Example:
SSD1331_SetDotSize(2);
SSD1331_Dot(50, 50, BLACK);


This function draws a dot.
SSD1331_Dot(x, y, color)

  • x: x position. Valid values: 0..96
  • y: y position. Valid values: 0..64
  • color: color parameter.
Example:
SSD1331_Dot(50, 50, BLACK);


This function sets the type of font.
SSD1331_SetFont(font, letterspacing)

  • font: Pointer to read all the array.
  • letterspacing: Letter spacing. Valid values: 1, 2, 3...
Example:
SSD1331_SetFont(Courier_New_Bold_20, 0);


This function draws a character.
SSD1331_WriteChar(c, x, y, color1, color2)

  • c: character to be written.
  • x: x position. Valid values: 0..96
  • y: y position. Valid values: 0..64
  • color1: Top color.
  • color2: Bottom color.
Example:
SSD1331_WriteChar('A', 10, 10, BLACK, WHITE);


This function writes text constant.
SSD1331_ConstText(buffer, x, y, color1, color2)

  • buffer: Pointer to read all the array.
  • x: x position. Valid values: 0..96
  • y: y position. Valid values: 0..64
  • color1: Top color.
  • color2: Bottom color.
Example:
SSD1331_ConstText("pic18fxx", 0, 0, BLACK, WHITE);


This function writes text variable.
SSD1331_Text(buffer, x, y, color1, color2)

  • buffer: Pointer to read all the array.
  • x: x position. Valid values: 0..96
  • y: y position. Valid values: 0..64
  • color1: Top color.
  • color2: Bottom color.
Example:
unsigned char i;
char buffer2[20];
i = 22;
sprintf(buffer2, "%03d", i);
SSD1331_Text(buffer2, 10, 10, BLACK, WHITE);


These functions write text with alignment.

SSD1331_TextLEFT(buffer, y, color1, color2, color3)
SSD1331_TextCENTER(buffer, y, color1, color2)
SSD1331_TextRIGHT(buffer, y, color1, color2)

  • buffer: Pointer to read all the array.
  • y: y position. Valid values: 0..64
  • color1: Top color.
  • color2: Bottom color.
  • color3: Bottom color2.
Examples:
SSD1331_TextLEFT((char*)"ILI9341", 10, BLACK, WHITE, RED);
SSD1331_TextCENTER((char*)"ILI9341",30, BLACK, WHITE);
SSD1331_TextRIGHT((char*)"ILI9341", 50, BLACK, WHITE);


This function fills screen with given color.
SSD1331_FillScreen(color

  • color: color parameter.
Example:
SSD1331_FillScreen(BRIGHTGREEN);


This function draws a box.
SSD1331_Box(x1, y1, x2, y2, color)

  • x1: x coordinate of the upper left rectangle corner. Valid values: 0..96 
  • y1: y coordinate of the upper left rectangle corner. Valid values: 0..64
  • x2: x coordinate of the lower right rectangle corner. Valid values: 0..96
  • y2: y coordinate of the lower right rectangle corner. Valid values: 0..64
  • color: color parameter.
Example:
SSD1331_Box(0, 0, 50, 50, BLUE);


This function draws a line.
SSD1331_Line(x1, y1, x2, y2, color)

  • x1: x coordinate of the line start. Valid values: 0..96
  • y1: y coordinate of the line start. Valid values: 0..64
  • x2: x coordinate of the line end. Valid values: 0..96
  • y2: y coordinate of the line end. Valid values: 0..64
  • color: color parameter.
Example:
SSD1331_Line(1, 1, 50, 50, GREEN);


This function draws a rectangle.
SSD1331_Rectangle(x1, y1, x2, y2, color)

  • x1: x coordinate of the upper left rectangle corner. Valid values: 0..96 
  • y1: y coordinate of the upper left rectangle corner. Valid values: 0..64
  • x2: x coordinate of the lower right rectangle corner. Valid values: 0..96
  • y2: y coordinate of the lower right rectangle corner. Valid values: 0..64
  • color: color parameter.
Example:
SSD1331_Rectangle(1, 1, 50, 50, GREEN);


This function draws a rounded edge rectangle.
SSD1331_RectangleRound(x1, y1, x2, y2, radius, color)

  • radius: radius of the rounded edge.
Example:
SSD1331_RectangleRound(1, 1, 50, 50, 6, GREEN);


This function draws a filled rounded edge rectangle.

SSD1331_RectangleRoundFill(x1, y1, x2, y2, radius, color)
Example:
SSD3131_RectangleRoundFill(1, 1, 50, 50, 6, GREEN);


This function draws a circle.
SSD1331_Circle(x1, y1, radius, color)

  • x1: x coordinate of the circle center. Valid values: 0..96
  • y1: y coordinate of the circle center. Valid values: 0..64
  • radius: radius size
  • color: color parameter.
Example:
SSD1331_Circle(50, 30, 10, BLACK);


This function draws a filled circle.
SSD1331_CircleFill(x1, y1, radius, color)
Example:
SSD1331_CircleFill(50, 30, 10, BRIGHTRED);


This function draws an image on a desired location.
SSD1331_Icon(buffer, x, y, width, height)

  • buffer: Pointer to read all the array.
  • x: x position.
  • y: y position.
  • width: width of the image in pixels.
  • height: height of the image in pixels.
Example:
SSD1331_Icon(icon_play, 10, 16, 20, 34);
 

This function draws an image with transparent color on a desired location.
SSD1331_IconTransparent(buffer, x, y, width, height, color);

  • buffer: Pointer to read all the array.
  • x: x position.
  • y: y position.
  • width: width of the image in pixels.
  • height: height of the image in pixels.
  • color: transparent color.
Example:
SSD1331_IconTransparent(icon_speaker, 10, 16, 22, 18, WHITE);


 Connection.


Note:
The pins CS, RESET and DC can be configured in the file ili9341.h

Bitmap Editor. C#
This software programed at c# can be used to make bitmaps.


0 comments:

Post a Comment