- Create `Include/` folder for all main projects - Fix some issues here and there (found while moving things) - All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
39 lines
883 B
C++
39 lines
883 B
C++
#include "Tactility/app/display/DisplaySettings.h"
|
|
|
|
#include <Tactility/Preferences.h>
|
|
|
|
namespace tt::app::display {
|
|
|
|
tt::Preferences preferences("display");
|
|
|
|
#define BACKLIGHT_DUTY_KEY "backlight_duty"
|
|
#define ROTATION_KEY "rotation"
|
|
|
|
void setBacklightDuty(uint8_t value) {
|
|
preferences.putInt32(BACKLIGHT_DUTY_KEY, (int32_t)value);
|
|
}
|
|
|
|
uint8_t getBacklightDuty() {
|
|
int32_t result;
|
|
if (preferences.optInt32(BACKLIGHT_DUTY_KEY, result)) {
|
|
return (uint8_t)(result % 256);
|
|
} else {
|
|
return 200;
|
|
}
|
|
}
|
|
|
|
void setRotation(lv_display_rotation_t rotation) {
|
|
preferences.putInt32(ROTATION_KEY, (int32_t)rotation);
|
|
}
|
|
|
|
lv_display_rotation_t getRotation() {
|
|
int32_t rotation;
|
|
if (preferences.optInt32(ROTATION_KEY, rotation)) {
|
|
return (lv_display_rotation_t)rotation;
|
|
} else {
|
|
return LV_DISPLAY_ROTATION_0;
|
|
}
|
|
}
|
|
|
|
} // namespace
|