Merge pull request #740 from ernicek/ernicek/support-64-48
Added support for OLED with size 64x48
This commit is contained in:
		
						commit
						bc979883c2
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -143,6 +143,7 @@ int ssd1306_init(const ssd1306_t *dev)
 | 
				
			||||||
        case 32:
 | 
					        case 32:
 | 
				
			||||||
            pin_cfg = 0x02;
 | 
					            pin_cfg = 0x02;
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					        case 48:
 | 
				
			||||||
        case 64:
 | 
					        case 64:
 | 
				
			||||||
            pin_cfg = 0x12;
 | 
					            pin_cfg = 0x12;
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
| 
						 | 
					@ -244,6 +245,9 @@ int ssd1306_load_frame_buffer(const ssd1306_t *dev, uint8_t buf[])
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    size_t len = dev->width * dev->height / 8;
 | 
					    size_t len = dev->width * dev->height / 8;
 | 
				
			||||||
    if (dev->screen == SSD1306_SCREEN) {
 | 
					    if (dev->screen == SSD1306_SCREEN) {
 | 
				
			||||||
 | 
					        if (dev->width == 64 && dev->height == 48)
 | 
				
			||||||
 | 
					            ssd1306_set_column_addr(dev, 32, 32 + dev->width -1);
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
            ssd1306_set_column_addr(dev, 0, dev->width - 1);
 | 
					            ssd1306_set_column_addr(dev, 0, dev->width - 1);
 | 
				
			||||||
        ssd1306_set_page_addr(dev, 0, dev->height / 8 - 1);
 | 
					        ssd1306_set_page_addr(dev, 0, dev->height / 8 - 1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue