diff --git a/cube/User/Inc/oled.h b/cube/User/Inc/oled.h index 2583157..b790a13 100644 --- a/cube/User/Inc/oled.h +++ b/cube/User/Inc/oled.h @@ -17,6 +17,8 @@ void oledInit(void); +/* + * Will be used only internal void oled_CLS(void); void oled_Set_Pos(unsigned char x,unsigned char y);//Set the coordinate void oled_WrDat(unsigned char data); //Write Data @@ -26,12 +28,10 @@ void oled_P8x16Str(unsigned char x,unsigned char y,char ch[]); void oled_PrintBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char bmp[]); void oled_Fill(unsigned char dat); -//void oled_PrintValueC(unsigned char x, unsigned char y,char data); -//void oled_PrintValueI(unsigned char x, unsigned char y, int data); -//void oled_PrintValueF(unsigned char x, unsigned char y, float data, unsigned char num); void oled_PrintEdge(void); void oled_Cursor(unsigned char cursor_column, unsigned char cursor_row); void oled_PrintLine(void); +*/ void oledClear(); void oledPrint(char msg[]); diff --git a/cube/User/Src/oled.c b/cube/User/Src/oled.c index 94e2bd7..0b61b8a 100644 --- a/cube/User/Src/oled.c +++ b/cube/User/Src/oled.c @@ -36,7 +36,7 @@ static void __LEDPIN_CS(GPIO_PinState v) { HAL_GPIO_WritePin(Display_CS_GPIO_Port, Display_CS_Pin, v); } -void oled_WrDat(unsigned char data) +static void oled_WrDat(unsigned char data) { __LEDPIN_CS(LOW); __LEDPIN_DC(HIGH); @@ -45,7 +45,8 @@ void oled_WrDat(unsigned char data) __LEDPIN_CS(HIGH); } -void oled_WrCmd(unsigned char cmd) + +static void oled_WrCmd(unsigned char cmd) { __LEDPIN_CS(LOW); __LEDPIN_DC(LOW); @@ -54,7 +55,8 @@ void oled_WrCmd(unsigned char cmd) __LEDPIN_CS(HIGH); } -void oled_Set_Pos(unsigned char x, unsigned char y) + +static void oled_Set_Pos(unsigned char x, unsigned char y) { oled_WrCmd(0xb0+y); oled_WrCmd(((x&0xf0)>>4)|0x10); @@ -62,7 +64,7 @@ void oled_Set_Pos(unsigned char x, unsigned char y) } -void oled_Fill(unsigned char bmp_data) +static void oled_Fill(unsigned char bmp_data) { unsigned char y,x; @@ -78,7 +80,7 @@ void oled_Fill(unsigned char bmp_data) -void oled_CLS(void) +static void oled_CLS(void) { unsigned char y,x; for(y=0;y<8;y++) @@ -91,21 +93,24 @@ void oled_CLS(void) } } -void oled_DLY_ms(unsigned int ms) +static void oled_DLY_ms(unsigned int ms) { uint32_t start = HAL_GetTick(); while (HAL_GetTick() < start + ms); } -void SetStartColumn(unsigned char d) +/* + * unused +static void SetStartColumn(unsigned char d) { oled_WrCmd(0x00+d%16); // Set Lower Column Start Address for Page Addressing Mode // Default => 0x00 oled_WrCmd(0x10+d/16); // Set Higher Column Start Address for Page Addressing Mode // Default => 0x10 } +*/ -void SetAddressingMode(unsigned char d) +static void SetAddressingMode(unsigned char d) { oled_WrCmd(0x20); // Set Memory Addressing Mode oled_WrCmd(d); // Default => 0x02 @@ -114,33 +119,38 @@ void SetAddressingMode(unsigned char d) // 0x02 => Page Addressing Mode } -void SetColumnAddress(unsigned char a, unsigned char b) +/* + * unused +static void SetColumnAddress(unsigned char a, unsigned char b) { oled_WrCmd(0x21); // Set Column Address oled_WrCmd(a); // Default => 0x00 (Column Start Address) oled_WrCmd(b); // Default => 0x7F (Column End Address) } - -void SetPageAddress(unsigned char a, unsigned char b) +*/ +/* + * unused +static void SetPageAddress(unsigned char a, unsigned char b) { oled_WrCmd(0x22); // Set Page Address oled_WrCmd(a); // Default => 0x00 (Page Start Address) oled_WrCmd(b); // Default => 0x07 (Page End Address) } +*/ -void SetStartLine(unsigned char d) +static void SetStartLine(unsigned char d) { oled_WrCmd(0x40|d); // Set Display Start Line // Default => 0x40 (0x00) } -void SetContrastControl(unsigned char d) +static void SetContrastControl(unsigned char d) { oled_WrCmd(0x81); // Set Contrast Control oled_WrCmd(d); // Default => 0x7F } -void Set_Charge_Pump(unsigned char d) +static void Set_Charge_Pump(unsigned char d) { oled_WrCmd(0x8D); // Set Charge Pump oled_WrCmd(0x10|d); // Default => 0x10 @@ -148,7 +158,7 @@ void Set_Charge_Pump(unsigned char d) // 0x14 (0x04) => Enable Charge Pump } -void Set_Segment_Remap(unsigned char d) +static void Set_Segment_Remap(unsigned char d) { oled_WrCmd(0xA0|d); // Set Segment Re-Map // Default => 0xA0 @@ -156,7 +166,7 @@ void Set_Segment_Remap(unsigned char d) // 0xA1 (0x01) => Column Address 0 Mapped to SEG127 } -void Set_Entire_Display(unsigned char d) +static void Set_Entire_Display(unsigned char d) { oled_WrCmd(0xA4|d); // Set Entire Display On / Off // Default => 0xA4 @@ -164,7 +174,7 @@ void Set_Entire_Display(unsigned char d) // 0xA5 (0x01) => Entire Display On } -void Set_Inverse_Display(unsigned char d) +static void Set_Inverse_Display(unsigned char d) { oled_WrCmd(0xA6|d); // Set Inverse Display On/Off // Default => 0xA6 @@ -172,13 +182,13 @@ void Set_Inverse_Display(unsigned char d) // 0xA7 (0x01) => Inverse Display On } -void Set_Multiplex_Ratio(unsigned char d) +static void Set_Multiplex_Ratio(unsigned char d) { oled_WrCmd(0xA8); // Set Multiplex Ratio oled_WrCmd(d); // Default => 0x3F (1/64 Duty) } -void Set_Display_On_Off(unsigned char d) +static void Set_Display_On_Off(unsigned char d) { oled_WrCmd(0xAE|d); // Set Display On/Off // Default => 0xAE @@ -186,13 +196,16 @@ void Set_Display_On_Off(unsigned char d) // 0xAF (0x01) => Display On } -void SetStartPage(unsigned char d) +/* + * unused +static void SetStartPage(unsigned char d) { oled_WrCmd(0xB0|d); // Set Page Start Address for Page Addressing Mode // Default => 0xB0 (0x00) } +*/ -void Set_Common_Remap(unsigned char d) +static void Set_Common_Remap(unsigned char d) { oled_WrCmd(0xC0|d); // Set COM Output Scan Direction // Default => 0xC0 @@ -200,13 +213,13 @@ void Set_Common_Remap(unsigned char d) // 0xC8 (0x08) => Scan from COM63 to 0 } -void Set_Display_Offset(unsigned char d) +static void Set_Display_Offset(unsigned char d) { oled_WrCmd(0xD3); // Set Display Offset oled_WrCmd(d); // Default => 0x00 } -void Set_Display_Clock(unsigned char d) +static void Set_Display_Clock(unsigned char d) { oled_WrCmd(0xD5); // Set Display Clock Divide Ratio / Oscillator Frequency oled_WrCmd(d); // Default => 0x80 @@ -214,7 +227,7 @@ void Set_Display_Clock(unsigned char d) // D[7:4] => Oscillator Frequency } -void Set_Precharge_Period(unsigned char d) +static void Set_Precharge_Period(unsigned char d) { oled_WrCmd(0xD9); // Set Pre-Charge Period oled_WrCmd(d); // Default => 0x22 (2 Display Clocks [Phase 2] / 2 Display Clocks [Phase 1]) @@ -222,7 +235,7 @@ void Set_Precharge_Period(unsigned char d) // D[7:4] => Phase 2 Period in 1~15 Display Clocks } -void Set_Common_Config(unsigned char d) +static void Set_Common_Config(unsigned char d) { oled_WrCmd(0xDA); // Set COM Pins Hardware Configuration oled_WrCmd(0x02|d); // Default => 0x12 (0x10) @@ -230,16 +243,19 @@ void Set_Common_Config(unsigned char d) // Disable COM Left/Right Re-Map } -void Set_VCOMH(unsigned char d) +static void Set_VCOMH(unsigned char d) { oled_WrCmd(0xDB); // Set VCOMH Deselect Level oled_WrCmd(d); // Default => 0x20 (0.77*VCC) } -void Set_NOP(void) +/* + * unused +static void Set_NOP(void) { oled_WrCmd(0xE3); // Command for No Operation } +*/ void oledInit(void) { @@ -274,8 +290,9 @@ void oledInit(void) oled_Set_Pos(0,0); } - -void oled_P6x8Char(unsigned char x,unsigned char y,unsigned char ch) +/* + * unused +static void oled_P6x8Char(unsigned char x,unsigned char y,unsigned char ch) { unsigned char c=0,i=0; @@ -291,8 +308,9 @@ void oled_P6x8Char(unsigned char x,unsigned char y,unsigned char ch) oled_WrDat(F6x8[c][i]); } } +*/ -void oled_P6x8Str(unsigned char x,unsigned char y,char ch[]) +static void oled_P6x8Str(unsigned char x,unsigned char y,char ch[]) { coloredMsg(LOG_BLUE, false, "OLED: %d %d %s", x, y, ch); @@ -315,7 +333,9 @@ void oled_P6x8Str(unsigned char x,unsigned char y,char ch[]) } } -void oled_P8x16Str(unsigned char x,unsigned char y,char ch[]) +/* + * unused +static void oled_P8x16Str(unsigned char x,unsigned char y,char ch[]) { unsigned char c=0,i=0,j=0; while (ch[j]!='\0') @@ -340,10 +360,12 @@ void oled_P8x16Str(unsigned char x,unsigned char y,char ch[]) j++; } } +*/ - -void oled_PrintBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char bmp[]) +/* + * unused +static void oled_PrintBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,unsigned char bmp[]) { int ii=0; unsigned char x,y; @@ -356,8 +378,11 @@ void oled_PrintBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned c } } } +*/ -void oled_Cursor(unsigned char cursor_column, unsigned char cursor_row) +/* + * unused +static void oled_Cursor(unsigned char cursor_column, unsigned char cursor_row) { if(cursor_row != 0) { @@ -371,7 +396,7 @@ void oled_Cursor(unsigned char cursor_column, unsigned char cursor_row) oled_WrDat(0xFF); } } - +*/ #define MAX_LINES 8