示例#1
0
void oled_invert(unsigned char i)
{
	if(i==1)
  	oled_write_cmd(0xA7); 
  else
  	oled_write_cmd(0xA6); 
}
示例#2
0
void oled_print2(unsigned char x, unsigned char y, char *text)
{
	int l;
  int w, h;
  int i = 0;
  int pos = 0;

	for(l = 0; l<strlen(text); l++)
  {
		i = 0;
		for(w = 0; w<MicroTech10FontInfo[(unsigned char)text[l]].Width; w++)
		for(h = 0; h<=MicroTech10FontInfo[(unsigned char)text[l]].Height/8; h++)
		{
			oled_write_cmd(0x00 + ((w + pos + x + 2) & 0x0F));
			oled_write_cmd(0x10 + (((w + pos + x + 2) & 0xF0) >> 4));
			oled_write_cmd(0xB0 + h + y);

			//paint_byte(img, w + pos + y, h+x, MicroTech10FontInfo[text[l]].Ptr[i++]);
//			oled_write_data(OCR14FontInfo[(unsigned char)text[l]].Ptr[i++]);
			oled_write_data(MicroTech10FontInfo[(unsigned char)text[l]].Ptr[i++]);
		}
		pos += w;
	}

}
示例#3
0
void oled_flip_vertical(unsigned char f)
{
	if(f==1)
		oled_write_cmd(0xA1); // reversed scan
	else
		oled_write_cmd(0xA0); // reversed scan
}
/******************************************************************************
 * FunctionName : peri_oled_off.
 * Description  : turn off the oled.
 * Parameters   : none.
 * Returns      : none.
*******************************************************************************/
void ICACHE_FLASH_ATTR
peri_oled_off(void)
{
	oled_write_cmd(0X8D);
	oled_write_cmd(0X10);
	oled_write_cmd(0XAE);
}
示例#5
0
void oled_flip_horizontal(unsigned char f)
{
	if(f==1)
  	oled_write_cmd(0xC8); // reversed scan 
  else
  	oled_write_cmd(0xC0); // reversed scan 
}
/******************************************************************************
 * FunctionName : peri_oled_on.
 * Description  : turn on the oled.
 * Parameters   : none.
 * Returns      : none.
*******************************************************************************/
void ICACHE_FLASH_ATTR
peri_oled_on(void)
{
	oled_write_cmd(0X8D);
	oled_write_cmd(0X14);
	oled_write_cmd(0XAF);
}
static void ICACHE_FLASH_ATTR
oled_set_position(unsigned char x, unsigned char y)
{
	oled_write_cmd(0xb0+y);
	oled_write_cmd(((x&0xf0)>>4)|0x10);
	oled_write_cmd((x&0x0f)|0x01);
}
示例#8
0
void oled_init(void)
{
	oled_write_cmd(0x81); // contrast
	oled_write_cmd(0x00); // 0..0xFF
	oled_write_cmd(0xAF); // OLED on
	
	write_bit(1, 1);
}
示例#9
0
void oled_clear_line(unsigned char r)
{
		int i;
		oled_write_cmd(0x10);
		oled_write_cmd(0x02);
		oled_write_cmd(0xB0+r);
		for (i=0;i<128;i++)
		{
			oled_write_data(0x00);
		}
}
示例#10
0
void oled_clear(void)
{
	int r;
	int i;
	for(r=0; r<8; r++)
	{
		oled_write_cmd(0x10);
		oled_write_cmd(0x02);
		oled_write_cmd(0xB0+r);
		for (i=0;i<128;i++)
		{
			oled_write_data(0x00);
		}
	}
}
示例#11
0
/******************************************************************************
 * FunctionName : peri_oled_clean_screen.
 * Description  : clean the screen of the oled.
 * Parameters   : none.
 * Returns      : none.
*******************************************************************************/
void ICACHE_FLASH_ATTR
peri_oled_clean_screen(void)
{
	unsigned char m,n;
	for(m=0;m<8;m++)
	{
		oled_write_cmd(0xb0+m);		//page0-page1
		oled_write_cmd(0x00);		//low column start address
		oled_write_cmd(0x10);		//high column start address
		for(n=0;n<132;n++)
		{
			oled_write_data(0);
		}
	}
}
示例#12
0
void oled_print(unsigned char line, unsigned char pos, unsigned char invert, char *txt)
{
	int pos2 = pos*6 + 2;
	int l;
	unsigned char p;

	oled_write_cmd(0x00 + (pos2 & 0x0F));
	oled_write_cmd(0x10 + ((pos2 & 0xF0) >> 4));
	
	oled_write_cmd(0xB0 + line);
	
	for(l = 0; l<strlen(txt); l++)
	{
		for(p = 0; p<6; p++)
		{
			if(invert==1)
				oled_write_data(~font_normal[((unsigned char)txt[l])*6+p]);		
			else if(invert==2)
					oled_write_data(font_bold[((unsigned char)txt[l])*6+p]);
			else
				oled_write_data(font_normal[((unsigned char)txt[l])*6+p]);
		}
	}
}
示例#13
0
void oled_brightness(unsigned char br)
{
	oled_write_cmd(0x81); // contrast
	oled_write_cmd(br); // 0..0xFF
}
示例#14
0
/******************************************************************************
 * FunctionName : peri_i2c_oled_init
 * Description  : initialize the oled.
 * Parameters   : none.
 * Returns      : none.
*******************************************************************************/
bool ICACHE_FLASH_ATTR
peri_i2c_oled_init(void)
{
	i2c_init();
	os_delay_us(60000);
	os_delay_us(40000);

	oled_write_cmd(0xae); // turn off oled panel
	oled_write_cmd(0x00); // set low column address
	oled_write_cmd(0x10); // set high column address
	oled_write_cmd(0x40); // set start line address
	oled_write_cmd(0x81); // set contrast control register

	oled_write_cmd(0xa0);
	oled_write_cmd(0xc0);

	oled_write_cmd(0xa6); // set normal display
	oled_write_cmd(0xa8); // set multiplex ratio(1 to 64)
	oled_write_cmd(0x3f); // 1/64 duty
	oled_write_cmd(0xd3); // set display offset
	oled_write_cmd(0x00); // not offset
	oled_write_cmd(0xd5); // set display clock divide ratio/oscillator frequency
	oled_write_cmd(0x80); // set divide ratio
	oled_write_cmd(0xd9); // set pre-charge period
	oled_write_cmd(0xf1);
	oled_write_cmd(0xda); // set com pins hardware configuration
	oled_write_cmd(0x12);
	oled_write_cmd(0xdb); // set vcomh
	oled_write_cmd(0x40);
	oled_write_cmd(0x8d); // set Charge Pump enable/disable
	oled_write_cmd(0x14); // set(0x10) disable
	oled_write_cmd(0xaf); // turn on oled panel

	peri_oled_clean_screen();  //OLED CLS

	return oledstat;
}