Quick fix initial
This commit is contained in:
parent
ac429f9148
commit
683419bc4a
1 changed files with 9 additions and 5 deletions
|
|
@ -75,6 +75,10 @@
|
|||
#define SH1106_CHARGE_PUMP_DIS (0x8A)
|
||||
#define SH1106_CHARGE_PUMP_VALUE (0x30)
|
||||
|
||||
#define SH1106_SET_PAGE_ADDRESS (0xB0)
|
||||
#define SH1106_SET_LOW_COL_ADDR (0x00)
|
||||
#define SH1106_SET_HIGH_COL_ADDR (0x10)
|
||||
|
||||
#ifdef SSD1306_DEBUG
|
||||
#define debug(fmt, ...) printf("%s: " fmt "\n", "SSD1306", ## __VA_ARGS__)
|
||||
#else
|
||||
|
|
@ -148,7 +152,6 @@ int ssd1306_init(const ssd1306_t *dev)
|
|||
uint8_t pin_cfg;
|
||||
switch (dev->height) {
|
||||
case 16:
|
||||
break;
|
||||
case 32:
|
||||
pin_cfg = 0x02;
|
||||
break;
|
||||
|
|
@ -234,11 +237,11 @@ static int sh1106_go_coordinate(const ssd1306_t *dev, uint8_t x, uint8_t y) {
|
|||
if (x >= dev->width || y >= dev->height) return -EINVAL;
|
||||
int err = 0;
|
||||
x+=2 ; //offset : panel is 128 ; RAM is 132 for sh1106
|
||||
if ((err = ssd1306_command(dev, 0xB0 + y))) // Set row
|
||||
if ((err = ssd1306_command(dev, SH1106_SET_PAGE_ADDRESS + y))) // Set row
|
||||
return err;
|
||||
if ((err = ssd1306_command(dev, x & 0xf))) // Set lower column address
|
||||
if ((err = ssd1306_command(dev, SH1106_SET_LOW_COL_ADDR | (x & 0xf)))) // Set lower column address
|
||||
return err;
|
||||
return ssd1306_command(dev, 0x10 | (x >> 4)); //Set higher column address
|
||||
return ssd1306_command(dev, SH1106_SET_HIGH_COL_ADDR | (x >> 4)); //Set higher column address
|
||||
}
|
||||
|
||||
int ssd1306_load_frame_buffer(const ssd1306_t *dev, uint8_t buf[])
|
||||
|
|
@ -247,7 +250,8 @@ int ssd1306_load_frame_buffer(const ssd1306_t *dev, uint8_t buf[])
|
|||
uint8_t j;
|
||||
|
||||
size_t len = dev->width * dev->height / 8;
|
||||
if(dev->screen == SSD1306_SCREEN) {
|
||||
if(dev->screen == SSD1306_SCREEN)
|
||||
{
|
||||
ssd1306_set_column_addr(dev, 0, dev->width - 1);
|
||||
ssd1306_set_page_addr(dev, 0, dev->height / 8 - 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue