低分辨率OLED驱动讨论
时间:10-02
整理:3721RD
点击:
附上一段驱动代码,
那么问题来了, 如何显示数据转换成8bit数据可以直接写到ssd1306里面去?
- void LCD_BlockWrite_ST7789S(kal_uint16 startx,kal_uint16 starty,kal_uint16 endx,kal_uint16 endy)
- {
- kal_uint16 x, y;
- kal_uint32 addr, frame_buff_ptr;
- kal_uint64 temp;
-
- //__WFD_lcd_RollbackPortIFSetting(0);
- DRV_WriteReg32(LCD_ROI_CMD_ADDR_REG,MAIN_LCD_CMD_ADDR);
- DRV_WriteReg32(LCD_ROI_DATA_ADDR_REG,MAIN_LCD_DATA_ADDR);
- ASSERT(lcd_assert_fail==KAL_FALSE);
- lcd_assert_fail = KAL_TRUE;
- #if defined(MAIN_LCD_16BIT_MODE_RGB888)
- SET_LCD_SEND_RES_MODE(1);
- #endif
-
- if(endx >= LCD_SSD1306_WIDTH)
- {
- endx = LCD_SSD1306_WIDTH-1;
- }
- if(endy >= LCD_SSD1306_HEIGHT)
- {
- endy = LCD_SSD1306_HEIGHT-1;
- }
- #if defined(__mtk_TARGET__)
- addr= REG_LCD_LAYER0_BUFF_ADDR;//get_lcd_frame_buffer_address();
- //addr= get_lcd_frame_buffer_address();
- #endif
- for(y=starty;y<endy;++y)
- {
- for(x=startx; x<endx;x++)
- {
- DRV_MAINLCD_GET_BUFFER_PIXEL_TMP(addr,LCD_SSD1306_WIDTH,x, y,temp_pixel);
- GD_PUT_BUF_PIXEL_1(showd_bufer,LCD_SSD1306_WIDTH,x,y,temp_pixel);
- }
- }
- addr=(kal_uint32)(showd_bufer);
- for(y = 0; y<LCD_SSD1306_ROW; y++)
- {
- for(x= startx; x<endx; x++)
- {
- frame_buff_ptr = addr+(y)*LCD_SSD1306_WIDTH+x;
- temp = (*((kal_uint8 *)frame_buff_ptr));
- LCD_GotoXY_SSD1306(x, y); //this line should to adjust by LCD module
- SERIAL_LCD_DataWrite(temp);
- }
- }
-
- ENABLE_LCD_TRANSFER_COMPLETE_INT;
- DISABLE_LCD_ROI_CTRL_CMD_FIRST;
- START_LCD_TRANSFER;
-
- lcd_assert_fail = KAL_FALSE;
- }
- const unsigned char LCDSetArray[]=
- {
- 0x01, // 0000 0001
- 0x02, // 0000 0010
- 0x04, // 0000 0100
- 0x08, // 0000 1000
- 0x10, // 0001 0000
- 0X20, // 0010 0000
- 0x40, // 0100 0000
- 0x80 // 1000 0000
- };
- const unsigned char LCDReSetArray[]=
- {
- 0xFE, // 1111 1110
- 0xFD, // 1111 1101
- 0xFB, // 1111 1011
- 0xF7, // 1111 0111
- 0xEF, // 1110 1111
- 0xDF, // 1101 1111
- 0xBF, // 1011 1111
- 0x7F // 0111 1111
- };
- #define LCD_DRV_HW_TO_RGB_R(VALUE) ((kal_uint8)(((VALUE)&0Xf800)>>8))
- #define LCD_DRV_HW_TO_RGB_G(VALUE) ((kal_uint8)(((VALUE)&0X07e0)>>3))
- #define LCD_DRV_HW_TO_RGB_B(VALUE) ((kal_uint8)(((VALUE)&0X001f)>>3))
- #define LCD_DRV_RGB_TO_BW(R,G,B) (((unsigned short)(((int)(R)+(int)(G)+(int)(B))/(int)3)>=0x80)?1:0)
- #define GD_PUT_BUF_PIXEL_1(BUF,PITCH,X,Y,VALUE) (((VALUE)<=0)?((*((kal_uint8*)BUF+(((Y)/8)*PITCH+X)))|= LCDSetArray[(Y)%8]): ((*((kal_uint8*)BUF+(((Y)/8)*PITCH+X))) &= LCDReSetArray[(Y)%8]));
- #define DRV_MAINLCD_GET_BUFFER_PIXEL_TMP(BUF,PITCH,X,Y,VALUE) (VALUE=(!(*((kal_uint16*)BUF+((Y)*(PITCH)+(X))))))
那么问题来了, 如何显示数据转换成8bit数据可以直接写到ssd1306里面去?
这的确是个问题,我也想不明白,帮顶
以前功能机好像有一个什么宏吧,配了后黑白屏的,就是8bit的吧,不过太久了,也记不清楚了。
对于MTK驱动模式是搞不定了,用自己方法实现了
好同志,,不错,哈哈
多谢,老大帮顶