This commit is contained in:
Ken Van Hoeylandt 2026-02-10 21:11:33 +01:00
parent fc941ff495
commit d178d674f4
3 changed files with 7 additions and 4 deletions

View File

@ -17,7 +17,7 @@
spi0 {
compatible = "espressif,esp32-spi";
host = <SPI2_HOST>;
pin-mosi = <&gpio0 19 GPIO_FLAG_NONE>;
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
pin-mosi = <19>;
pin-sclk = <18>;
};
};

View File

@ -1,6 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
#include <driver/i2c.h>
#include <new>
#include <tactility/error_esp32.h>
#include <tactility/driver.h>
#include <tactility/drivers/gpio_controller.h>
@ -205,7 +207,8 @@ static error_t start(Device* device) {
return ERROR_RESOURCE;
}
auto* data = new Esp32SpiInternal(sda_descriptor, scl_descriptor);
auto* data = new(std::nothrow) Esp32SpiInternal(sda_descriptor, scl_descriptor);
if (data == nullptr) return ERROR_OUT_OF_MEMORY;
device_set_driver_data(device, data);
return ERROR_NONE;

View File

@ -9,7 +9,7 @@
#include <cstdlib>
#include <new>
#define GPIO_INTERNAL_API(driver) ((struct GpioControllerApi*)driver->api)
#define GPIO_INTERNAL_API(driver) ((struct GpioControllerApi*)(driver)->api)
extern "C" {