diff --git a/ssd1306.c b/ssd1306.c --- a/ssd1306.c +++ b/ssd1306.c @@ -86,7 +86,6 @@ void ssd1306_Init(void) for(i=5000; i>1; i--) SSD_Reset_High(); - WriteCommand(0xAE); WriteCommand(0xD5); WriteCommand(0x80); @@ -113,93 +112,10 @@ void ssd1306_Init(void) WriteCommand(0xA6); // normaldisplay WriteCommand(0xAF); // display on - - - // Clear buffer -// for(i=0;i<900;i++) -// ssd1306_Buffer[i] = 0; - - /************************************************* - // ssd1306 Initialization Command - *************************************************/ - /* - // Lower Column Address - WriteCommand(0x00); // Set Lower Column Address - GPIO_SetBits(GPIOA,GPIO_Pin_15);//turn on status LED - // High Column Address - WriteCommand(0x10); // Set Higher Column Address - // Display Start Line - WriteCommand(0x40); // Set Display Start Line -#ifdef DEBUG_BOARD - curContrast = lastContrast = 0x30; -#else - curContrast = lastContrast = 0xCF; -#endif - // Contrast Control Register - WriteCommand(0x81); // Set Contrast Control - WriteCommand(lastContrast); // 0 ~ 255 0x1f - - // Re-map - WriteCommand(0xA1); // [A0]:column address 0 is map to SEG0 , [A1]: columnaddress 131 is map to SEG0 - // Entire Display ON/OFF - WriteCommand(0xA4); // A4=ON - // Normal or Inverse Display - WriteCommand(0XA6); // Normal Display - // Multiplex Ratio - WriteCommand(0xA8); // Set Multiplex Ratio - WriteCommand(0x3f); // Set to 36 Mux - // Set DC-DC - WriteCommand(0xAD); // Set DC-DC - WriteCommand(0x8B); // 8B=ON, 8A=Off - - - // Display ON/OFF - WriteCommand(0xAE); // AF=ON , AE=OFF - // Display Offset - WriteCommand(0xD3); // Set Display Offset - WriteCommand(0x00); // No offset - // Display Clock Divide - WriteCommand(0xD5); // Set Clock Divide - WriteCommand(0x20); // Set to 80Hz - // Area Color Mode - WriteCommand(0xD8); // Set Area Color On or Off - WriteCommand(0x00); // Mono Mode - // COM Pins Hardware Configuration - WriteCommand(0xDA); // Set Pins HardwareConfiguration - WriteCommand(0x12); - // VCOMH - WriteCommand(0xDB); // Set VCOMH - WriteCommand(0x00); - // VP - WriteCommand(0xD9); // Set VP - WriteCommand(0x22); // P1=2 , P2=2 - - // Set Common output scan direction - WriteCommand(0xc8);// Set COM scan direction - - // For SSD1306 Set the address mode - WriteCommand(0x20);// Set address mode - WriteCommand(0x00);// Set address mode horizontal - - // Set the page start address - WriteCommand(0xb0); - WriteCommand(0x00); - WriteCommand(0x10); - - // Turn on the controller - pre_on = ssd1306_ON(); -// // Set Charge pump -// WriteCommand(0x8D); // Set Charge pump -// WriteCommand(0x14); // 0x14=ON, 0x10=Off -// -// // Turn on the display -// WriteCommand(0xaf); -*/ } void ssd1306_block_write(void) { - // Set col start addr to 0 WriteCommand(0x21); WriteCommand(0x00); @@ -211,16 +127,10 @@ void ssd1306_block_write(void) WriteCommand(0x00); // start page addr WriteCommand(4); // end page addr (height / 8) - + // Write data uint32_t i = 0; - - - for(i=0;i<512;i++) WriteData(ssd1306_Buffer[i]); -// for(i=0;i<512;i++) - // * * * * -// WriteData(0b00000011); } @@ -594,13 +504,7 @@ const DeviceProp ssd1306_Prop = .yPixel = 64, }; - - - - - -// FontData - +// Times New Roman font const char fontData[240][5] = { // Refer to "Times New Roman" Font Database // Basic Characters