From: David Odin Date: Mon, 27 Mar 2017 15:44:11 +0000 (+0200) Subject: fixed the set_pixel function X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=2af1c2bd8dcfa7e990daea43189696e3682e7cc1;p=soft%2Flpc122x%2Fcore fixed the set_pixel function --- diff --git a/extdrv/ssd130x_oled_driver.c b/extdrv/ssd130x_oled_driver.c index 06c0d68..46f7140 100644 --- a/extdrv/ssd130x_oled_driver.c +++ b/extdrv/ssd130x_oled_driver.c @@ -403,11 +403,11 @@ int ssd130x_update_modified(struct oled_display* conf) /* Change our internal buffer, without actually displaying the changes */ int ssd130x_set_pixel(struct oled_display* conf, uint8_t x0, uint8_t y0, uint8_t state) { - uint8_t* addr = gddram_start + ((y0 >> 3) * 128) + x0; + uint8_t* addr = gddram_start + ((y0 / 8) * 128) + x0; if (state != 0) { - *addr |= (0x01 << (7 - (x0 & 0x03))); + *addr |= (0x01 << (y0 % 8)); } else { - *addr &= ~(0x01 << (7 - (x0 & 0x03))); + *addr &= ~(0x01 << (y0 % 8)); } return 0; }