void LED_P8x16Str(unsigned char x,unsigned char y,char ch[]) { unsigned char c=0,i=0,j=0; while (ch[j]!='\0') { c =ch[j]-32; if(x>120) { x=0; y++; } LED_Set_Pos(x,y); for(i=0;i<8;i++) { LED_WrDat(F8X16[(c<<4)+i]); } LED_Set_Pos(x,y+1); for(i=0;i<8;i++) { LED_WrDat(F8X16[(c<<4)+i+8]); } x+=8; j++; } }
void LED_Cursor(unsigned char cursor_column, unsigned char cursor_row) { if(cursor_row != 0) { if(cursor_column == 1) LED_Set_Pos(0, cursor_row + 2); else LED_Set_Pos(80 + (cursor_column - 2)*6, cursor_row + 2); LED_WrDat(0xFF); LED_WrDat(0xFF); LED_WrDat(0xFF); LED_WrDat(0xFF); LED_WrDat(0xFF); LED_WrDat(0xFF); } }
void LED_Init(void) { unsigned char i; LEDPIN_Init(); // LED_PORT=0X0F; //LED_SCLH;;; //LED_RSTL;;; digitalWrite(SCL_PIN,HIGH);;; digitalWrite(RST_PIN,LOW);;; // for(i=0;i<100;i++)asm("nop"); LED_DLY_ms(50); //LED_RSTH;;; digitalWrite(RST_PIN,HIGH); Set_Display_On_Off(0x00); // Display Off (0x00/0x01) Set_Display_Clock(0x80); // Set Clock as 100 Frames/Sec Set_Multiplex_Ratio(0x3F); // 1/64 Duty (0x0F~0x3F) Set_Display_Offset(0x00); // Shift Mapping RAM Counter (0x00~0x3F) SetStartLine(0x00); // Set Mapping RAM Display Start Line (0x00~0x3F) Set_Charge_Pump(0x04); // Enable Embedded DC/DC Converter (0x00/0x04) SetAddressingMode(0x02); // Set Page Addressing Mode (0x00/0x01/0x02) Set_Segment_Remap(0x01); // Set SEG/Column Mapping Set_Common_Remap(0x08); // Set COM/Row Scan Direction Set_Common_Config(0x10); // Set Sequential Configuration (0x00/0x10) SetContrastControl(0xCF); // Set SEG Output Current Set_Precharge_Period(0xF1); // Set Pre-Charge as 15 Clocks & Discharge as 1 Clock Set_VCOMH(0x40); // Set VCOM Deselect Level Set_Entire_Display(0x00); // Disable Entire Display On (0x00/0x01) Set_Inverse_Display(0x00); // Disable Inverse Display On (0x00/0x01) Set_Display_On_Off(0x01); // Display On (0x00/0x01) LED_Fill(0x00); //clear all LED_Set_Pos(0,0); }
void LED_Init(void) { LEDPIN_Init(); /*while(1) { //MB_Sleep(1000); LED_WrCmd(0xaa); //MB_Sleep(1000); XGpio_DiscreteWrite(&led2, reset_CHANNEL, 0x1); XGpio_DiscreteWrite(&led1, reset_CHANNEL, 0x0); }*/ XGpio_DiscreteWrite(&reset, reset_CHANNEL, 0x0); //usleep(800); MB_Sleep(80); XGpio_DiscreteWrite(&reset, reset_CHANNEL, 0x1); Set_Display_On_Off(0x00); // Display Off (0x00/0x01) Set_Display_Clock(0x80); // Set Clock as 100 Frames/Sec Set_Multiplex_Ratio(0x3F); // 1/64 Duty (0x0F~0x3F) Set_Display_Offset(0x00); // Shift Mapping RAM Counter (0x00~0x3F) SetStartLine(0x00); // Set Mapping RAM Display Start Line (0x00~0x3F) Set_Charge_Pump(0x04); // Enable Embedded DC/DC Converter (0x00/0x04) SetAddressingMode(0x02); // Set Page Addressing Mode (0x00/0x01/0x02) Set_Segment_Remap(0x01); // Set SEG/Column Mapping 0x00左右反置 0x01正常 Set_Common_Remap(0x08); // Set COM/Row Scan Direction 0x00上下反置 0x08正常 Set_Common_Config(0x10); // Set Sequential Configuration (0x00/0x10) SetContrastControl(0xCF); // Set SEG Output Current Set_Precharge_Period(0xF1); // Set Pre-Charge as 15 Clocks & Discharge as 1 Clock Set_VCOMH(0x40); // Set VCOM Deselect Level Set_Entire_Display(0x00); // Disable Entire Display On (0x00/0x01) Set_Inverse_Display(0x00); // Disable Inverse Display On (0x00/0x01) Set_Display_On_Off(0x01); // Display On (0x00/0x01) LED_Fill(0x00); //初始清屏 LED_Set_Pos(0, 0); }
void LED_PrintBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char bmp[]) { int ii=0; unsigned char x,y; for(y=y0;y<=y1;y++) { LED_Set_Pos(x0,y); for(x=x0;x<x1;x++) { LED_WrDat(bmp[ii++]); } } }
//============================================================== void LED_P6x8Char(u8 x, u8 y, u8 ch) { u8 c = 0, i = 0; // j=0; c = ch - 32; if (x > 122) { x = 0; y++; } LED_Set_Pos(x, y); for (i = 0; i < 6; i++) { LED_WrDat(F6x8[c][i]); } }
void LED_P6x8Char(unsigned char x,unsigned char y,unsigned char ch) { unsigned char c=0,i=0,j=0; c =ch-32; if(x>122) { x=0; y++; } LED_Set_Pos(x,y); for(i=0;i<6;i++) { LED_WrDat(F6x8[c][i]); } }
//============================================================== void LED_P6x8Str(u8 x, u8 y, u8 ch[]) { u8 c = 0, i = 0, j = 0; while (ch[j] != '\0') { c = ch[j] - 32; if (x > 126) { x = 0; y++; } LED_Set_Pos(x, y); for (i = 0; i < 6; i++) { LED_WrDat(F6x8[c][i]); } x += 6; j++; } }