mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 03:57:07 +03:00
more display refactoring, led bug correction
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "gds_private.h"
|
||||
|
||||
#define SHADOW_BUFFER
|
||||
#define USE_IRAM
|
||||
|
||||
static char TAG[] = "SSD1306";
|
||||
|
||||
@@ -79,10 +80,15 @@ static bool Init( struct GDS_Device* Device ) {
|
||||
Device->FramebufferSize = ( Device->Width * Device->Height ) / 8;
|
||||
Device->Framebuffer = calloc( 1, Device->FramebufferSize );
|
||||
NullCheck( Device->Framebuffer, return false );
|
||||
|
||||
|
||||
#ifdef SHADOW_BUFFER
|
||||
if (Device->IF == IF_I2C) Device->Shadowbuffer = malloc( Device->FramebufferSize );
|
||||
else Device->Shadowbuffer = heap_caps_malloc( Device->FramebufferSize, MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA );
|
||||
#ifdef USE_IRAM
|
||||
// benchmarks showed little gain to have SPI memory already in IRAL vs letting driver copy
|
||||
if (Device->IF == IF_SPI) Device->Shadowbuffer = heap_caps_malloc( Device->FramebufferSize, MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA );
|
||||
else
|
||||
#else
|
||||
Device->Shadowbuffer = malloc( Device->FramebufferSize );
|
||||
#endif
|
||||
NullCheck( Device->Shadowbuffer, return false );
|
||||
memset(Device->Shadowbuffer, 0xFF, Device->FramebufferSize);
|
||||
#endif
|
||||
@@ -95,7 +101,7 @@ static bool Init( struct GDS_Device* Device ) {
|
||||
Device->WriteCommand( Device, 0x8D );
|
||||
Device->WriteCommand( Device, 0x14 );
|
||||
|
||||
// COM pins HW config (alternative:EN if 64, DIS if 32, remap:DIS) - some display might need something difference
|
||||
// COM pins HW config (alternative:EN if 64, DIS if 32, remap:DIS) - some display might need something different
|
||||
Device->WriteCommand( Device, 0xDA );
|
||||
Device->WriteCommand( Device, ((Device->Height == 64 ? 1 : 0) << 4) | (0 < 5) );
|
||||
|
||||
@@ -131,8 +137,9 @@ static bool Init( struct GDS_Device* Device ) {
|
||||
static const struct GDS_Device SSD1306 = {
|
||||
.DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast,
|
||||
.SetVFlip = SetVFlip, .SetHFlip = SetHFlip,
|
||||
.DrawPixelFast = GDS_DrawPixelFast,
|
||||
.Update = Update, .Init = Init,
|
||||
//.DrawPixelFast = GDS_DrawPixelFast,
|
||||
//.ClearWindow = ClearWindow,
|
||||
};
|
||||
|
||||
struct GDS_Device* SSD1306_Detect(char *Driver, struct GDS_Device* Device) {
|
||||
@@ -140,6 +147,7 @@ struct GDS_Device* SSD1306_Detect(char *Driver, struct GDS_Device* Device) {
|
||||
|
||||
if (!Device) Device = calloc(1, sizeof(struct GDS_Device));
|
||||
*Device = SSD1306;
|
||||
Device->Depth = 1;
|
||||
ESP_LOGI(TAG, "SSD1306 driver");
|
||||
|
||||
return Device;
|
||||
|
||||
Reference in New Issue
Block a user