/* Function		: charDraw(char row, char column, int data)
 * Description  : write char to address
 * Input		: (row, column), data
 * Output		: char at address
 */
void charDraw(char row, char column, int data)
{
	int h;

	if (row > SSD1306_MAXROWS)
	{
		row = SSD1306_MAXROWS;
	}

	if (column > SSD1306_LCDWIDTH)
	{
		column = SSD1306_LCDWIDTH;
	}

	if ( data < 32 || data > 129 )
	{
		data = '.';
	}

	h = (data - 32) * 6;

	setAddress(row, column);
	SSD1306SendData( (char *)FONT6x8 + h, 6 );

}
Пример #2
0
/* Function    : Fill_RAM_FONT
 * Description : Writes a charcter on the OLED display at a column, row.
 *               with a large font.
 * Input       : character, column, row, span and width
 * Output      : None
 */
void Fill_RAM_FONT(  unsigned char number, 
                     unsigned char column,
                     unsigned char row,
                     unsigned char span, 
                     unsigned char width )
{
int i,j,test; 
int adder=0;
int jump = 0;

   jump = (number - 32);
	for(i=row;i>=row-span+1;i--)
	{
		Set_Start_Page(i);
		Set_Start_Column(column);
	
		for(j=0;j<width;j++)
		{
			test = 	j+(adder*width)+(jump*28);
			SSD1306SendData(data_table_LARGE[test]);
		}
		adder++;
	}

}
Пример #3
0
/* Function    : Fill_RAM_PAGE
 * Description : Fills an OLED page with a particular data
 * Input       : page no.[0-7], Data
 * Output      : None
 */
void Fill_RAM_PAGE(unsigned char page, unsigned char Data)
{
   unsigned char j;

   Set_Start_Page(page);
   Set_Start_Column(0x00);

   for(j=0;j<128;j++)
   {
      SSD1306SendData(Data);
   }
}
Пример #4
0
/* Function    : Fill_RAM_FONT_SMALL
 * Description : Writes a charcter on the OLED display at a column, row.
 *               with a small font.
 * Input       : character, column, row
 * Output      : None
 */
void Fill_RAM_FONT_SMALL(  unsigned char number, 
                           unsigned char column,
                           unsigned char row )
{
	int j=0;
	Set_Start_Page(row);
	Set_Start_Column(column);	
	
	for(j=0;j<SMALL_FONT_WIDTH;j++)
	{
		SSD1306SendData(data_table_SMALL[j+(number*SMALL_FONT_WIDTH)]);
	}
}
Пример #5
0
/* Function    : Fill_RAM( unsigned char c )
 * Description : Fills the OLED with one particular data
 * Input       : Data
 * Output      : None
 */
void Fill_RAM(unsigned char Data)
{
   unsigned char i,j;

   for(i=0;i<8;i++)
   {
      Set_Start_Page(i);
      Set_Start_Column(0x00);

      for(j=0;j<128;j++)
      {
         SSD1306SendData(Data);
      }
   }
}
/* Function		: clearScreen(void)
 * Description	: wipes data in memory to 0x00
 * Input		: none
 * Output		: blank screen (0x00)
 */
void clearScreen(void)
{
	char ramData[] = {0x00};

	char i,j;

	for(i=0; i < 8 ;i++)
	{
		setAddress(i,0);

	    for(j=0; j < SSD1306_LCDWIDTH; j++)
	    {
	    	SSD1306SendData(ramData, 1);
	    }
	}
}
/* Function		: horizontalLine(char xStart, char xStop, char y)
 * Description  : draw horizontal line from xStart to xStop
 * Input		: X Start & Stop coordinate, Y
 * Output		: display horizontal line
 */
void horizontalLine(char xStart, char xStop, char y)
{
	char temp = 0;
	char page, a;
	char ramData[] = { 0x00 };

	if (xStart > SSD1306_LCDWIDTH - 1)
	{
		xStart = SSD1306_LCDWIDTH - 1;
	}

	if (xStop > SSD1306_LCDWIDTH - 1)
	{
		xStop = SSD1306_LCDWIDTH - 1;
	}

	if (y > SSD1306_LCDHEIGHT - 1)
	{
		y = SSD1306_LCDHEIGHT - 1;
	}

	if (xStart > xStop)
	{
		temp = xStart;
		xStart = xStop;
		xStop = temp;
	}

	page = y / 8;
	temp = 0x80 >> (y %8);

	a = xStart;
	ramData[0] = temp;

	setAddress(page, xStart);

	while (a <= xStop)
	{
		SSD1306SendData(ramData, 1);
		a++;
	}
}
/* Function		: pixelDraw(char x, char y)
 * Description  : draw individual pixel at coordinate
 * Input		: X,Y coordinates
 * Output		: single pixel
 */
void pixelDraw(char x, char y)
{
	char page, temp;
	char coordinate[] = {0x00};

	if (x > SSD1306_LCDWIDTH - 1)
	{
		x = SSD1306_LCDWIDTH - 1;
	}

	if (y > SSD1306_LCDHEIGHT - 1)
	{
		y = SSD1306_LCDHEIGHT - 1;
	}

	page = y / 8;
	temp = 0x80 >> (y % 8);
	coordinate[0] = temp;

	setAddress(page,x);
	SSD1306SendData(coordinate, 1);

}