vanhofen
2 years ago
4 changed files with 51 additions and 2 deletions
@ -0,0 +1,45 @@ |
|||||
|
--- a/glcddrivers/framebuffer.c |
||||
|
+++ b/glcddrivers/framebuffer.c |
||||
|
@@ -24,6 +24,18 @@ |
||||
|
#include "config.h" |
||||
|
#include "framebuffer.h" |
||||
|
|
||||
|
+int proc_put(const char *path, const char *value, const int len) |
||||
|
+{ |
||||
|
+ int ret, ret2; |
||||
|
+ int pfd = open(path, O_WRONLY); |
||||
|
+ if (pfd < 0) |
||||
|
+ return pfd; |
||||
|
+ ret = write(pfd, value, len); |
||||
|
+ ret2 = close(pfd); |
||||
|
+ if (ret2 < 0) |
||||
|
+ return ret2; |
||||
|
+ return ret; |
||||
|
+} |
||||
|
|
||||
|
namespace GLCD |
||||
|
{ |
||||
|
@@ -443,4 +455,13 @@ |
||||
|
bbox[3] = 0; |
||||
|
} |
||||
|
|
||||
|
+void cDriverFramebuffer::SetBrightness(unsigned int dimm) |
||||
|
+{ |
||||
|
+ std::string value = std::to_string((int)(255*dimm*10/100)); |
||||
|
+ if (access("/proc/stb/lcd/oled_brightness", F_OK) == 0) |
||||
|
+ proc_put("/proc/stb/lcd/oled_brightness", value.c_str(), value.length()); |
||||
|
+ else if (access("/proc/stb/fp/oled_brightness", F_OK) == 0) |
||||
|
+ proc_put("/proc/stb/fp/oled_brightness", value.c_str(), value.length()); |
||||
|
+} |
||||
|
+ |
||||
|
} // end of namespace |
||||
|
--- a/glcddrivers/framebuffer.h |
||||
|
+++ b/glcddrivers/framebuffer.h |
||||
|
@@ -53,6 +53,7 @@ |
||||
|
virtual void SetPixel(int x, int y, uint32_t data); |
||||
|
//virtual void Set8Pixels(int x, int y, unsigned char data); |
||||
|
virtual void Refresh(bool refreshAll = false); |
||||
|
+ virtual void SetBrightness(unsigned int); |
||||
|
}; |
||||
|
|
||||
|
} // end of namespace |
Loading…
Reference in new issue