Skip to content

Optimization of OLED graphic display module with SSD1306 controller - #44

Open
oleksii-kogutenko wants to merge 1 commit into
Kernel-GL-HRK:masterfrom
oleksii-kogutenko:alexandr_ssd1306
Open

Optimization of OLED graphic display module with SSD1306 controller#44
oleksii-kogutenko wants to merge 1 commit into
Kernel-GL-HRK:masterfrom
oleksii-kogutenko:alexandr_ssd1306

Conversation

@oleksii-kogutenko

@oleksii-kogutenko oleksii-kogutenko commented Nov 29, 2017

Copy link
Copy Markdown
  • update Makefile (compile analog clock with all target)
  • use compatible am335x-bone-common.dtsi with mpu6050
  • add i2c1 support added to dtsi
  • move defines to header file
  • optimization screen updater:
    • use "page addressing mode" for memory mode
    • send only modyfied bytes over i2c
    • decreased time of writing from 6 jiff items to {0-1} jiff items

@oleksii-kogutenko
oleksii-kogutenko force-pushed the alexandr_ssd1306 branch 2 times, most recently from 5785feb to c264e2e Compare December 11, 2017 16:55
@oleksii-kogutenko oleksii-kogutenko changed the title OLED graphic display module with SSD1306 controller Optimization of OLED graphic display module with SSD1306 controller Dec 11, 2017
 * update Makefile
 * use compatible am335x-bone-common.dtsi with mpu6050
 * add i2c1 support added to dtsi
 * move defines to header file
 * optimization screen updater:
   - use "page addressing mode" for memory mode
   - send only modyfied bytes over i2c
@oleksii-kogutenko

Copy link
Copy Markdown
Author

Debugs from optimization log:
[ 1200.812771] [ssd1306_UpdateScreen]==>[cur_pos:1024, start_pos:1016, size:8]
[ 1200.812796] [ssd1306_sendDataArea] size:8 pos:1016
[ 1200.813376] [ssd1306_sendDataArea] page:7, col:120, send_size:8, i:0
[ 1200.813706] diff: 0
[ 1201.016734] [ssd1306_UpdateScreen]==>[cur_pos:346, start_pos:337, size:9]
[ 1201.016755] [ssd1306_sendDataArea] size:9 pos:337
[ 1201.017274] [ssd1306_sendDataArea] page:2, col:81, send_size:9, i:0
[ 1201.017637] [ssd1306_UpdateScreen]==>[cur_pos:453, start_pos:452, size:1]
[ 1201.017643] [ssd1306_sendDataArea] size:1 pos:452
[ 1201.018119] [ssd1306_sendDataArea] page:3, col:68, send_size:1, i:0
[ 1201.018281] [ssd1306_UpdateScreen]==>[cur_pos:455, start_pos:454, size:1]
[ 1201.018310] [ssd1306_sendDataArea] size:1 pos:454
[ 1201.018760] [ssd1306_sendDataArea] page:3, col:70, send_size:1, i:0
[ 1201.018921] [ssd1306_UpdateScreen]==>[cur_pos:469, start_pos:456, size:13]
[ 1201.018949] [ssd1306_sendDataArea] size:13 pos:456
[ 1201.019440] [ssd1306_sendDataArea] page:3, col:72, send_size:13, i:0
[ 1201.019887] [ssd1306_UpdateScreen]==>[cur_pos:1024, start_pos:1016, size:8]
[ 1201.019911] [ssd1306_sendDataArea] size:8 pos:1016
[ 1201.022534] [ssd1306_sendDataArea] page:7, col:120, send_size:8, i:0
[ 1201.022915] diff: 1

Comment thread ssd1306/ssd1306/ssd1306.h
{
u8 type;
u8 data[LCD_WIDTH * LCD_HEIGHT / 8];
} ssd1306_data_array;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intended to be used in external modules?

Comment thread ssd1306/ssd1306/ssd1306.h
size_t count, loff_t *ppos);
static int ssd1307fb_blank(int blank_mode, struct fb_info *info);
static void ssd1307fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
static void ssd1307fb_copyarea(struct fb_info *info, const struct fb_copyarea *area);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+static int ssd1307fb_blank(int blank_mode, struct fb_info *info); +static void ssd1307fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); +static void ssd1307fb_copyarea(struct fb_info *info, const struct fb_copyarea *area); +static void ssd1307fb_imageblit(struct fb_info *info, const struct fb_image *image);

static in the header file? what for?

@DevyatovAndrey DevyatovAndrey left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix checkpatch issues and make some clean up

if( (draw_x1>=0)&&(draw_y1>=0) ){
Graphic_setPoint(draw_x1, draw_y1);
}
if( (draw_x2<=127)&&(draw_y2<=63) ){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't you confused with these "magic numbers"?

if( 0 == r)
return;

// calculate 8 special point(0��45��90��135��180��225��270degree) display them

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a clean up - remove unnesessary comments/lines

Comment thread ssd1306/ssd1306/ssd1306.c
* __u16 capabilities; // see FB_CAP_*
* __u16 reserved[2]; // Reserved for future compatibility
* };
* */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this large bunch of dead code is unnesessary and could be deleted

Comment thread ssd1306/ssd1306/ssd1306.c
/* ******************************************************************
*
* *****************************************************************/
int ssd1306_UpdateScreen_old(struct ssd1306_data *drv_data)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this function is redunant

Comment thread ssd1306/ssd1306/ssd1306.c
}

//ssd1306_sendDataArea(drv_client, dataArray.data, sizeof(dataArray.data), 0);
//memcpy(&dataArray_lcd, &dataArray, sizeof(dataArray));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if possible -please fix checkpatch issues and remove unnesessary comments

Comment thread ssd1306/ssd1306/ssd1306.c
}

diff = get_jiffies_64() - jiff;
pr_info ("diff: %lld\n", diff); ///diff: 6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think time consumption could be hidden into debug defines

Comment thread ssd1306/ssd1306/ssd1306.c
ssd1306_first_start++;
} else {
while (cur_pos < msize) {
while (cur_pos < msize && dataArray.data[cur_pos] == dataArray_lcd.data[cur_pos])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point to calculate positions in buffer to update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants