Beispiel #1
0
  void OLED_write_1_num(unsigned char X,unsigned char Y,signed int s)
  {
     OLED_Set_Pos(X,Y);
	  if(s<0)
	 {
	 	s=0-s;
	 	OLED_write_char('-');
	 }
	 else
	 {
	   	OLED_write_char(' ');	
	 }
	 OLED_write_char(s+0x30);	 
  }
Beispiel #2
0
   //写float型的数据,小数点后三位,小数点前两位
  void OLED_write_float3(unsigned char X,unsigned char Y,float s)
  {
     unsigned int num;
     
     OLED_Set_Pos(X,Y); 
     if (s < 0)//判断正负
     {
         s = 0 - s;
         OLED_write_char('-');
     }
     else 
     {
         OLED_write_char(' ');			
     }
     num = (unsigned int)(s * 1000);
	 if((num/10000)!=0)
	 OLED_write_char((num/10000)+0x30);//十位
	 num=num%10000;
	 if((num/1000)!=0)
     OLED_write_char((num/1000)+0x30);//个位
     num = num % 1000;
	 OLED_write_char('.');
     OLED_write_char((num/100)+0x30);//小数点后一位
     num = num % 100;
     OLED_write_char((num/10)+0x30);//小数点后两位
     num = num % 10;
     OLED_write_char((num)+0x30);//小数点后第三位  
  }
Beispiel #3
0
void lcdPutChar(char_t c)
{
   if(c == '\r')
   {
      lcdColumn = 0;
   }
   else if(c == '\n')
   {
      lcdColumn = 0;
      lcdLine++;
   }
   else if(lcdLine < 2 && lcdColumn < 19)
   {
      //Set cursor
      if(lcdLine == 0)
         OLED_set_cursor(FIRST_LINE, lcdColumn);
      else
         OLED_set_cursor(SECOND_LINE, lcdColumn);

      //Display current character
      OLED_write_char(c);

      //Advance the cursor position
      if(++lcdColumn >= 19)
      {
         lcdColumn = 0;
         lcdLine++;
      }
   }
}
Beispiel #4
0
  void OLED_write_2_num(unsigned char X,unsigned char Y,signed int s)
  {
     OLED_Set_Pos(X,Y);
	 if(s<0)
	 {
	 	s=0-s;
	 	OLED_write_char('-');
	 }
	 else
	 {
	   	OLED_write_char(' ');	
	 }
	 if((s/10)!=0)
	 OLED_write_char((s/10)+0x30);
	 OLED_write_char((s%10)+0x30);	 
  }
Beispiel #5
0
void MENU_draw_loose(void) {
	OLED_clear();
	OLED_write_align_center(64,1,"YOU LOOSE!");
	OLED_write_align_center(64,2,"LIVES LEFT: ");
	OLED_write_char((lives + '0'));
	OLED_write_align_center(64,4,"NEW GAME");
	OLED_scroll_page_right(4,0);
	OLED_write_align_center(64,5,"CONTINUE");
}
/***************************************************************************//**
  OLED_write_string()
  See definition of OLED_write_string for details of how to use this function.
 */
void OLED_write_string
(
    const char *string
)
{
  while (*string != 0)
  {
      OLED_write_char( *string );
      ++string;
  }
}
Beispiel #7
0
void OLED_write_5_num(unsigned char X,unsigned char Y,signed long s)
{   
	 OLED_Set_Pos(X,Y);
	 if(s<0)
	 {
	 	s=0-s;
	 	OLED_write_char('-');
	 }
	 else
	 {
	   	OLED_write_char(' ');	
	 }
	 OLED_write_char((s/10000)+0x30);
	 s %= 10000;
	 OLED_write_char((s/1000)+0x30);
	 s %= 1000;
	 OLED_write_char((s/100)+0x30);
	 OLED_write_char(((s%100)/10)+0x30);
	 OLED_write_char((s%10)+0x30);	 
}
Beispiel #8
0
void MENU_draw_ingame(void) {
	OLED_clear();
	OLED_write_align_center(64,1,"IN GAME");
	OLED_write_align_center(64,4,"LIVES : ");
	OLED_write_char((lives + '0'));
}
Beispiel #9
0
void OLED_write_string(char *str) {
	while(*str) {
		OLED_write_char(*str++);
	}
}