initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#include "nb_display.h"
|
||||
#include "nb_internal.h"
|
||||
#include <esp_check.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
esp_err_t nb_display_create(nb_display_driver_t driver, nb_display_t* display) {
|
||||
ESP_RETURN_ON_ERROR(driver.create_display(display), nbi_tag, "failed to create driver");
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "nb_internal.h"
|
||||
|
||||
const char* nbi_tag = "nanobake";
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef NANOBAKE_NB_INTERNAL_H
|
||||
#define NANOBAKE_NB_INTERNAL_H
|
||||
|
||||
extern const char* nbi_tag;
|
||||
|
||||
#endif // NANOBAKE_NB_INTERNAL_H
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "nb_platform.h"
|
||||
#include <esp_check.h>
|
||||
#include "nb_display.h"
|
||||
#include "nb_touch.h"
|
||||
#include "nb_internal.h"
|
||||
|
||||
static const char* TAG = "nb_platform";
|
||||
|
||||
esp_err_t nb_platform_create(nb_platform_config_t config, nb_platform_t* platform) {
|
||||
ESP_LOGI(TAG, "display with driver %s", config.display_driver.name);
|
||||
ESP_RETURN_ON_ERROR(
|
||||
nb_display_create(config.display_driver, &(platform->display)),
|
||||
nbi_tag,
|
||||
"display driver init failed"
|
||||
);
|
||||
|
||||
ESP_LOGI(TAG, "touch with driver %s", config.touch_driver.name);
|
||||
ESP_RETURN_ON_ERROR(
|
||||
nb_touch_create(config.touch_driver, &(platform->touch)),
|
||||
nbi_tag,
|
||||
"touch driver init failed"
|
||||
);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "nb_touch.h"
|
||||
#include <esp_check.h>
|
||||
#include "nb_internal.h"
|
||||
|
||||
esp_err_t nb_touch_create(nb_touch_driver_t driver, nb_touch_t* touch) {
|
||||
ESP_RETURN_ON_ERROR(driver.init_io(&(touch->io_handle)), nbi_tag, "failed to init io");
|
||||
ESP_RETURN_ON_ERROR(driver.create_touch(touch->io_handle, &(touch->touch_handle)), nbi_tag, "failed to create driver");
|
||||
return ESP_OK;
|
||||
}
|
||||
Reference in New Issue
Block a user