Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ssd1306_clear_square function #16

Merged
merged 2 commits into from
Dec 15, 2023
Merged

Add ssd1306_clear_square function #16

merged 2 commits into from
Dec 15, 2023

Conversation

maro159
Copy link
Contributor

@maro159 maro159 commented Dec 5, 2023

It is expansion of idea introduced in PR #11
Funtion to clear area defined as square instead of single pixels may be simpler to use in some cases, at least in my opinion.

Also corrected single typo in ssd1306.h file

See an example:

#define FONT font_8x5
#define FONT_WIDTH (FONT[1]+FONT[2])
#define FONT_HEIGHT (FONT[0])
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADR 0x3C
#define OLED_I2C i2c1

// initialization
static ssd1306_t oled;
ssd1306_init(&oled, OLED_WIDTH, OLED_HEIGHT, OLED_ADR, OLED_I2C);
oled.external_vcc = true;

// displaying something...

// clear one line of text 
ssd1306_clear_square(&oled, 0, 0, OLED_WIDTH-1, FONT_HEIGHT);

Add function ssd1306_clear_square() which may be used to optimize display routines ex. to change only a single line of text
@daschr daschr merged commit 8467f5b into daschr:main Dec 15, 2023
@daschr
Copy link
Owner

daschr commented Dec 15, 2023

Sorry for the late reply. Indeed that's more comfortable.
Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants