Add DISABLE options to UserSettings.h #168
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
This is a nice library! I've been using this library with an ATtiny system, so minimizing memory usage is critical for sure.
My proposed changes make it easier to use the library's configuration options.
In the library's current state, it's necessary to comment out various
_ENABLE
options inssd1306_hal/UserSettings.h
, since they're basically all enabled by default:Unfortunately, this forces the user to modify the source code just to use the configuration options. This is rather inconvenient.
My proposal is to wrap the
CONFIG_xxxxxx_ENABLE
defines with#ifndef SSD1306_xxxxxx_DISABLE
conditions, like so:With this change, the various library features can be easily disabled with build flags, like
-DSSD1306_UNICODE_DISABLE
.The driving philosophy behind this change is that defines can easily be added at build time, but
define
statements in the code cannot be undone without changing the source code.SSD1306_
option name_DISABLE
to prevent potential clashing.CONFIG_xxxxxx_ENABLE
macros are still used within the library code. Only the way they're defined inUserSettings.h
has been changed.#ifndef CONFIG_ADAFRUIT_GFX_ENABLE
line, since it didn't do anything. I left the option commented out, since-DCONFIG_ADAFRUIT_GFX_ENABLE
can be passed to enable it.Thanks for considering- and again, great library.
-- Winston M