fix display dimmer (#20491)

This commit is contained in:
gemu 2024-01-15 21:58:46 +01:00 committed by GitHub
parent 3daea4f8fd
commit b0b2f22e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -193,6 +193,10 @@ void RA8876::DisplayOnff(int8_t on) {
}
}
void RA8876::dim10(uint8_t contrast, uint16_t contrast_gamma) {
dim(contrast / 16);
}
// 0-15
void RA8876::dim(uint8_t contrast) {
SPI.beginTransaction(m_spiSettings);

View File

@ -26,6 +26,8 @@
#include "driver/spi_master.h"
#endif
#include "tasmota_options.h"
#undef SPRINT
#define SPRINT(A) {char str[32];sprintf(str,"val: %d ",A);Serial.println((char*)str);}
@ -147,10 +149,14 @@ enum ExternalFontFamily
typedef uint8_t FontFlags;
#define RA8876_FONT_FLAG_XLAT_FULLWIDTH 0x01 // Translate ASCII to Unicode fullwidth forms
#ifndef RA8876_SPI_SPEED
// 1MHz. TODO: Figure out actual speed to use
// Data sheet section 5.2 says maximum SPI clock is 50MHz.
//#define RA8876_SPI_SPEED 10000000
#define RA8876_SPI_SPEED 25000000
//#define RA8876_SPI_SPEED 25000000
#define RA8876_SPI_SPEED 40000000
#endif
// With SPI, the RA8876 expects an initial byte where the top two bits are meaningful. Bit 7
// is A0, bit 6 is WR#. See data sheet section 7.3.2 and section 19.
@ -501,6 +507,7 @@ class RA8876 : public Renderer {
void setDrawMode(uint8_t mode);
void setDrawMode_reg(uint8_t mode);
void dim(uint8_t contrast);
void dim10(uint8_t contrast, uint16_t contrast_gamma);
void FastString(uint16_t x,uint16_t y,uint16_t tcolor, const char* str);
private: