1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-18 17:53:47 +01:00

Improve PSRAM support (#2884)

This commit is contained in:
Oxan van Leeuwen
2022-01-03 22:35:15 +01:00
committed by GitHub
parent dce3713f12
commit dbc2812022
11 changed files with 162 additions and 69 deletions

View File

@@ -5,6 +5,7 @@
#include "esphome/core/color.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
namespace esphome {
namespace display {
@@ -15,7 +16,8 @@ const Color COLOR_OFF(0, 0, 0, 0);
const Color COLOR_ON(255, 255, 255, 255);
void DisplayBuffer::init_internal_(uint32_t buffer_length) {
this->buffer_ = new (std::nothrow) uint8_t[buffer_length]; // NOLINT
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
this->buffer_ = allocator.allocate(buffer_length);
if (this->buffer_ == nullptr) {
ESP_LOGE(TAG, "Could not allocate buffer for display!");
return;