Driver improvements (#535)
- New drivers: - SD SPI - spi_peripheral - touch_placeholder - display_placeholder - Devicetree compiler: - Implement phandle-arrays - Implement device addresses - Add placeholder drivers to all devices with a SPI display - SPI driver: add `cs-pins` and set them to high on driver start - FileSystem: add `file_system_set_owner()` and `file_system_get_owner()` - File locking is now checking if the related `FileSystem` is part of a shared SPI bus - Add `device_get_child_count()` - SDMMC driver: Remove default of `slot` value - Fix for Crowpanel Basic 3.5" display (add delay to booting) - Fix for LilyGO T-HMI SD card mounting (delayed mounting by disabling it initially in the dts)
This commit is contained in:
committed by
GitHub
parent
e50659a3fb
commit
599fa46766
@@ -45,6 +45,7 @@ def parse_binding(file_path: str, binding_dirs: list[str]) -> Binding:
|
|||||||
required=details.get('required', False),
|
required=details.get('required', False),
|
||||||
description=details.get('description', '').strip(),
|
description=details.get('description', '').strip(),
|
||||||
default=details.get('default', None),
|
default=details.get('default', None),
|
||||||
|
element_type=details.get('element-type', None),
|
||||||
)
|
)
|
||||||
properties_dict[name] = prop
|
properties_dict[name] = prop
|
||||||
filename = os.path.basename(file_path)
|
filename = os.path.basename(file_path)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str:
|
|||||||
return "{ " + ",".join(value_list) + " }"
|
return "{ " + ",".join(value_list) + " }"
|
||||||
elif type == "phandle":
|
elif type == "phandle":
|
||||||
return find_phandle(devices, property.value)
|
return find_phandle(devices, property.value)
|
||||||
elif type == "phandle-array":
|
elif type == "phandles":
|
||||||
value_list = list()
|
value_list = list()
|
||||||
if isinstance(property.value, list):
|
if isinstance(property.value, list):
|
||||||
for item in property.value:
|
for item in property.value:
|
||||||
@@ -93,10 +93,26 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str:
|
|||||||
# If it's a string, assume it's a #define and show it as-is
|
# If it's a string, assume it's a #define and show it as-is
|
||||||
return property.value
|
return property.value
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Unsupported phandle-array type for {property.value}")
|
raise Exception(f"Unsupported phandles type for {property.name} with value {property.value} ")
|
||||||
else:
|
else:
|
||||||
raise DevicetreeException(f"property_to_string() has an unsupported type: {type}")
|
raise DevicetreeException(f"property_to_string() has an unsupported type: {type}")
|
||||||
|
|
||||||
|
def resolve_phandle_array_entries(device_property, devices):
|
||||||
|
"""Convert a phandle-array DTS property into a list of C initializer strings."""
|
||||||
|
entries = []
|
||||||
|
if device_property.type == "phandle-array":
|
||||||
|
items = device_property.value
|
||||||
|
elif device_property.type == "values":
|
||||||
|
items = [PropertyValue(type="values", value=device_property.value)]
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
for item in items:
|
||||||
|
if isinstance(item, PropertyValue):
|
||||||
|
entries.append(property_to_string(DeviceProperty(name="", type=item.type, value=item.value), devices))
|
||||||
|
else:
|
||||||
|
entries.append(str(item))
|
||||||
|
return entries
|
||||||
|
|
||||||
def resolve_parameters_from_bindings(device: Device, bindings: list[Binding], devices: list[Device]) -> list:
|
def resolve_parameters_from_bindings(device: Device, bindings: list[Binding], devices: list[Device]) -> list:
|
||||||
compatible_property = find_device_property(device, "compatible")
|
compatible_property = find_device_property(device, "compatible")
|
||||||
if compatible_property is None:
|
if compatible_property is None:
|
||||||
@@ -119,11 +135,32 @@ def resolve_parameters_from_bindings(device: Device, bindings: list[Binding], de
|
|||||||
if device_property.name not in binding_property_names:
|
if device_property.name not in binding_property_names:
|
||||||
raise DevicetreeException(f"Device '{device.node_name}' has invalid property '{device_property.name}'")
|
raise DevicetreeException(f"Device '{device.node_name}' has invalid property '{device_property.name}'")
|
||||||
|
|
||||||
# Allocate total expected configuration arguments
|
node_name = get_device_node_name_safe(device)
|
||||||
result = [0] * len(binding_properties)
|
result = []
|
||||||
for index, binding_property in enumerate(binding_properties):
|
phandle_arrays = []
|
||||||
|
for binding_property in binding_properties:
|
||||||
device_property = find_device_property(device, binding_property.name)
|
device_property = find_device_property(device, binding_property.name)
|
||||||
# No property specified in DTS, use binding defaults
|
|
||||||
|
if binding_property.type == "phandle-array":
|
||||||
|
if binding_property.element_type is None:
|
||||||
|
raise DevicetreeException(f"phandle-array property '{binding_property.name}' requires 'element-type' in binding")
|
||||||
|
prop_safe = binding_property.name.replace("-", "_")
|
||||||
|
array_var = f"{node_name}_{prop_safe}"
|
||||||
|
if device_property is not None:
|
||||||
|
entries = resolve_phandle_array_entries(device_property, devices)
|
||||||
|
phandle_arrays.append((array_var, binding_property.element_type, entries))
|
||||||
|
result.append(f"({binding_property.element_type}*){array_var}")
|
||||||
|
result.append(str(len(entries)))
|
||||||
|
elif binding_property.default is not None:
|
||||||
|
result.append("NULL")
|
||||||
|
result.append("0")
|
||||||
|
elif binding_property.required:
|
||||||
|
raise DevicetreeException(f"device {device.node_name} doesn't have property '{binding_property.name}'")
|
||||||
|
else:
|
||||||
|
result.append("NULL")
|
||||||
|
result.append("0")
|
||||||
|
continue
|
||||||
|
|
||||||
if device_property is None:
|
if device_property is None:
|
||||||
if binding_property.default is not None:
|
if binding_property.default is not None:
|
||||||
temp_prop = DeviceProperty(
|
temp_prop = DeviceProperty(
|
||||||
@@ -131,30 +168,38 @@ def resolve_parameters_from_bindings(device: Device, bindings: list[Binding], de
|
|||||||
type=binding_property.type,
|
type=binding_property.type,
|
||||||
value=binding_property.default
|
value=binding_property.default
|
||||||
)
|
)
|
||||||
result[index] = property_to_string(temp_prop, devices)
|
result.append(property_to_string(temp_prop, devices))
|
||||||
elif binding_property.required:
|
elif binding_property.required:
|
||||||
raise DevicetreeException(f"device {device.node_name} doesn't have property '{binding_property.name}'")
|
raise DevicetreeException(f"device {device.node_name} doesn't have property '{binding_property.name}'")
|
||||||
elif binding_property.type == "bool" or binding_property.type == "boolean":
|
elif binding_property.type == "bool" or binding_property.type == "boolean":
|
||||||
if binding_property.default == "true" or binding_property.default == None:
|
if binding_property.default == "true" or binding_property.default == None:
|
||||||
result[index] = "true"
|
result.append("true")
|
||||||
else: # Explicit or implied false
|
else:
|
||||||
result[index] = "false"
|
result.append("false")
|
||||||
else:
|
else:
|
||||||
raise DevicetreeException(f"Device {device.node_name} doesn't have property '{binding_property.name}' and no default value is set")
|
raise DevicetreeException(f"Device {device.node_name} doesn't have property '{binding_property.name}' and no default value is set")
|
||||||
else:
|
else:
|
||||||
result[index] = property_to_string(device_property, devices)
|
result.append(property_to_string(device_property, devices))
|
||||||
return result
|
|
||||||
|
return result, phandle_arrays
|
||||||
|
|
||||||
def write_config(file, device: Device, bindings: list[Binding], devices: list[Device], type_name: str):
|
def write_config(file, device: Device, bindings: list[Binding], devices: list[Device], type_name: str):
|
||||||
node_name = get_device_node_name_safe(device)
|
node_name = get_device_node_name_safe(device)
|
||||||
config_type = f"{type_name}_config_dt"
|
config_type = f"{type_name}_config_dt"
|
||||||
config_variable_name = f"{node_name}_config"
|
config_variable_name = f"{node_name}_config"
|
||||||
|
|
||||||
|
config_params, phandle_arrays = resolve_parameters_from_bindings(device, bindings, devices)
|
||||||
|
|
||||||
|
# Write phandle-array variables before the config struct
|
||||||
|
for array_var, element_type, entries in phandle_arrays:
|
||||||
|
entries_str = ", ".join(entries)
|
||||||
|
file.write(f"static {element_type} {array_var}[] = {{ {entries_str} }};\n")
|
||||||
|
|
||||||
file.write(f"static const {config_type} {config_variable_name}" " = {\n")
|
file.write(f"static const {config_type} {config_variable_name}" " = {\n")
|
||||||
config_params = resolve_parameters_from_bindings(device, bindings, devices)
|
|
||||||
# Indent all params
|
# Indent all params
|
||||||
for index, config_param in enumerate(config_params):
|
for index, config_param in enumerate(config_params):
|
||||||
config_params[index] = f"\t{config_param}"
|
config_params[index] = f"\t{config_param}"
|
||||||
# Join with command and newline
|
# Join with comma and newline
|
||||||
if len(config_params) > 0:
|
if len(config_params) > 0:
|
||||||
config_params_joined = ",\n".join(config_params)
|
config_params_joined = ",\n".join(config_params)
|
||||||
file.write(f"{config_params_joined}\n")
|
file.write(f"{config_params_joined}\n")
|
||||||
@@ -178,7 +223,9 @@ def write_device_structs(file, device: Device, parent_device: Device, bindings:
|
|||||||
# Write config struct
|
# Write config struct
|
||||||
write_config(file, device, bindings, devices, type_name)
|
write_config(file, device, bindings, devices, type_name)
|
||||||
# Write device struct
|
# Write device struct
|
||||||
|
address_value = device.node_address if device.node_address is not None else "0"
|
||||||
file.write(f"static struct Device {node_name}" " = {\n")
|
file.write(f"static struct Device {node_name}" " = {\n")
|
||||||
|
file.write(f"\t.address = {address_value},\n")
|
||||||
file.write(f"\t.name = \"{device.node_name}\",\n") # Use original name
|
file.write(f"\t.name = \"{device.node_name}\",\n") # Use original name
|
||||||
file.write(f"\t.config = &{config_variable_name},\n")
|
file.write(f"\t.config = &{config_variable_name},\n")
|
||||||
file.write(f"\t.parent = {parent_value},\n")
|
file.write(f"\t.parent = {parent_value},\n")
|
||||||
|
|||||||
@@ -37,13 +37,17 @@ value: VALUE
|
|||||||
values: VALUE+
|
values: VALUE+
|
||||||
array: NUMBER+
|
array: NUMBER+
|
||||||
|
|
||||||
property_value: quoted_text_array | QUOTED_TEXT | "<" value ">" | "<" values ">" | "[" array "]" | PHANDLE
|
phandle_array_entry: "<" values ">"
|
||||||
|
phandle_array: phandle_array_entry ("," phandle_array_entry)+
|
||||||
|
|
||||||
|
property_value: quoted_text_array | QUOTED_TEXT | phandle_array | "<" value ">" | "<" values ">" | "[" array "]" | PHANDLE
|
||||||
device_property: PROPERTY_NAME ["=" property_value] ";"
|
device_property: PROPERTY_NAME ["=" property_value] ";"
|
||||||
|
|
||||||
NODE_ALIAS: /[a-zA-Z0-9_\-\/@]+/
|
NODE_ALIAS: /[a-zA-Z0-9_\-\/]+/
|
||||||
NODE_NAME: /[a-zA-Z0-9_\-\/@]+/
|
NODE_NAME: /[a-zA-Z0-9_\-\/]+/
|
||||||
|
NODE_ADDRESS: /[0-9a-zA-Z_]+/
|
||||||
|
|
||||||
device: (NODE_ALIAS ":")? NODE_NAME "{" (device | device_property)* "};"
|
device: (NODE_ALIAS ":")? NODE_NAME ("@" NODE_ADDRESS)? "{" (device | device_property)* "};"
|
||||||
|
|
||||||
dts_version: /[0-9a-zA-Z\-]+/
|
dts_version: /[0-9a-zA-Z\-]+/
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class DtsVersion:
|
|||||||
class Device:
|
class Device:
|
||||||
node_name: str
|
node_name: str
|
||||||
node_alias: str
|
node_alias: str
|
||||||
|
node_address: str
|
||||||
status: str
|
status: str
|
||||||
properties: list
|
properties: list
|
||||||
devices: list
|
devices: list
|
||||||
@@ -38,6 +39,7 @@ class BindingProperty:
|
|||||||
required: bool
|
required: bool
|
||||||
description: str
|
description: str
|
||||||
default: object = None
|
default: object = None
|
||||||
|
element_type: str = None
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Binding:
|
class Binding:
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class DtsTransformer(Transformer):
|
|||||||
def device(self, tokens: list):
|
def device(self, tokens: list):
|
||||||
node_name = None
|
node_name = None
|
||||||
node_alias = None
|
node_alias = None
|
||||||
|
node_address = None
|
||||||
status = None
|
status = None
|
||||||
properties = list()
|
properties = list()
|
||||||
child_devices = list()
|
child_devices = list()
|
||||||
@@ -37,6 +38,8 @@ class DtsTransformer(Transformer):
|
|||||||
node_name = item.value
|
node_name = item.value
|
||||||
elif type(item) is Token and item.type == 'NODE_ALIAS':
|
elif type(item) is Token and item.type == 'NODE_ALIAS':
|
||||||
node_alias = item.value
|
node_alias = item.value
|
||||||
|
elif type(item) is Token and item.type == 'NODE_ADDRESS':
|
||||||
|
node_address = item.value
|
||||||
elif type(item) is DeviceProperty:
|
elif type(item) is DeviceProperty:
|
||||||
if item.name == "status":
|
if item.name == "status":
|
||||||
status = item.value
|
status = item.value
|
||||||
@@ -44,7 +47,7 @@ class DtsTransformer(Transformer):
|
|||||||
properties.append(item)
|
properties.append(item)
|
||||||
elif type(item) is Device:
|
elif type(item) is Device:
|
||||||
child_devices.append(item)
|
child_devices.append(item)
|
||||||
return Device(node_name, node_alias, status, properties, child_devices)
|
return Device(node_name, node_alias, node_address, status, properties, child_devices)
|
||||||
def device_property(self, objects: List[object]):
|
def device_property(self, objects: List[object]):
|
||||||
name = objects[0]
|
name = objects[0]
|
||||||
# Boolean property has no value as the value is implied to be true
|
# Boolean property has no value as the value is implied to be true
|
||||||
@@ -67,6 +70,10 @@ class DtsTransformer(Transformer):
|
|||||||
if isinstance(object[0], PropertyValue):
|
if isinstance(object[0], PropertyValue):
|
||||||
return object[0]
|
return object[0]
|
||||||
return PropertyValue(type="value", value=object[0])
|
return PropertyValue(type="value", value=object[0])
|
||||||
|
def phandle_array_entry(self, tokens: list):
|
||||||
|
return tokens[0]
|
||||||
|
def phandle_array(self, tokens: list):
|
||||||
|
return PropertyValue(type="phandle-array", value=tokens)
|
||||||
def array(self, object):
|
def array(self, object):
|
||||||
return PropertyValue(type="array", value=object)
|
return PropertyValue(type="array", value=object)
|
||||||
def VALUE(self, token: Token):
|
def VALUE(self, token: Token):
|
||||||
|
|||||||
@@ -10,21 +10,23 @@ static const root_config_dt root_config = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct Device root = {
|
static struct Device root = {
|
||||||
|
.address = 0,
|
||||||
.name = "/",
|
.name = "/",
|
||||||
.config = &root_config,
|
.config = &root_config,
|
||||||
.parent = NULL,
|
.parent = NULL,
|
||||||
.internal = NULL
|
.internal = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const generic_device_config_dt test_device@0_config = {
|
static const generic_device_config_dt test_device_config = {
|
||||||
0,
|
0,
|
||||||
42,
|
42,
|
||||||
"hello"
|
"hello"
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct Device test_device@0 = {
|
static struct Device test_device = {
|
||||||
.name = "test-device@0",
|
.address = 0,
|
||||||
.config = &test_device@0_config,
|
.name = "test-device",
|
||||||
|
.config = &test_device_config,
|
||||||
.parent = &root,
|
.parent = &root,
|
||||||
.internal = NULL
|
.internal = NULL
|
||||||
};
|
};
|
||||||
@@ -38,6 +40,7 @@ static const bool_device_config_dt bool_test_device_config = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct Device bool_test_device = {
|
static struct Device bool_test_device = {
|
||||||
|
.address = 0,
|
||||||
.name = "bool-test-device",
|
.name = "bool-test-device",
|
||||||
.config = &bool_test_device_config,
|
.config = &bool_test_device_config,
|
||||||
.parent = &root,
|
.parent = &root,
|
||||||
@@ -46,7 +49,7 @@ static struct Device bool_test_device = {
|
|||||||
|
|
||||||
struct DtsDevice dts_devices[] = {
|
struct DtsDevice dts_devices[] = {
|
||||||
{ &root, "test,root", DTS_DEVICE_STATUS_OKAY },
|
{ &root, "test,root", DTS_DEVICE_STATUS_OKAY },
|
||||||
{ &test_device@0, "test,generic-device", DTS_DEVICE_STATUS_OKAY },
|
{ &test_device, "test,generic-device", DTS_DEVICE_STATUS_OKAY },
|
||||||
{ &bool_test_device, "test,bool-device", DTS_DEVICE_STATUS_OKAY },
|
{ &bool_test_device, "test,bool-device", DTS_DEVICE_STATUS_OKAY },
|
||||||
DTS_DEVICE_TERMINATOR
|
DTS_DEVICE_TERMINATOR
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
@@ -23,7 +21,6 @@ static bool initBoot() {
|
|||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#define TAG "twodotfour_sdcard"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -22,18 +24,29 @@
|
|||||||
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@@ -14,8 +11,7 @@ static bool initBoot() {
|
|||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay()
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -3,6 +3,9 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@@ -14,20 +17,36 @@
|
|||||||
gpio-count = <40>;
|
gpio-count = <40>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@@ -25,7 +23,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -23,20 +26,36 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@@ -25,7 +23,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -23,20 +26,36 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@@ -39,7 +38,6 @@ static bool initBoot() {
|
|||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -4,12 +4,14 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
model = "CYD 2432S032C";
|
model = "CYD 2432S032C";
|
||||||
|
|
||||||
gpio1 {
|
gpio0 {
|
||||||
compatible = "espressif,esp32-gpio";
|
compatible = "espressif,esp32-gpio";
|
||||||
gpio-count = <40>;
|
gpio-count = <40>;
|
||||||
};
|
};
|
||||||
@@ -18,22 +20,33 @@
|
|||||||
compatible = "espressif,esp32-i2c";
|
compatible = "espressif,esp32-i2c";
|
||||||
port = <I2C_NUM_0>;
|
port = <I2C_NUM_0>;
|
||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <&gpio1 33 GPIO_FLAG_NONE>;
|
pin-sda = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||||
pin-scl = <&gpio1 32 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio1 13 GPIO_FLAG_NONE>;
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio1 14 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio1 23 GPIO_FLAG_NONE>;
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio1 19 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio1 18 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
@@ -24,7 +23,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -32,19 +34,30 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
#include "devices/St7701Display.h"
|
#include "devices/St7701Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/kernel/SystemEvents.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@@ -16,7 +12,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
std::make_shared<St7701Display>(),
|
std::make_shared<St7701Display>(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_42,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector { GPIO_NUM_39 }
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi0");
|
|
||||||
check(spi_controller, "spi0 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(config),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -30,9 +31,14 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 47 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 47 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 41 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 48 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||||
pin-hd = <&gpio0 42 GPIO_FLAG_NONE>;
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
@@ -15,7 +13,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_10,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi0");
|
|
||||||
check(spi_controller, "spi0 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(config),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -39,9 +40,15 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
@@ -12,7 +10,6 @@ static bool initBoot() {
|
|||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -3,6 +3,9 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -13,19 +16,35 @@
|
|||||||
gpio-count = <40>;
|
gpio-count = <40>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@@ -17,7 +14,6 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
return {
|
return {
|
||||||
createPower(),
|
createPower(),
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
using SdCardDevice = tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SD_CS_PIN, // CS pin (IO5 on the module)
|
|
||||||
GPIO_NUM_NC, // MOSI override: leave NC to use SPI host pins
|
|
||||||
GPIO_NUM_NC, // MISO override: leave NC
|
|
||||||
GPIO_NUM_NC, // SCLK override: leave NC
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SD_SPI_HOST // SPI host for SD card (SPI3_HOST)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "driver/spi_common.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
// SD card (microSD)
|
|
||||||
constexpr auto SD_CS_PIN = GPIO_NUM_5;
|
|
||||||
constexpr auto SD_SPI_HOST = SPI3_HOST;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -4,6 +4,9 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -22,19 +25,35 @@
|
|||||||
pin-scl = <&gpio0 25 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 25 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
CROWPANEL_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -28,19 +30,30 @@
|
|||||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 7 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
CROWPANEL_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -28,19 +30,30 @@
|
|||||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 7 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <TCA9534.h>
|
#include <TCA9534.h>
|
||||||
@@ -25,7 +23,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
// See https://github.com/Elecrow-RD/CrowPanel-Advance-HMI-ESP32-AI-Display/blob/master/5.0/factory_code/factory_code.ino
|
|
||||||
GPIO_NUM_0, // It's actually not connected, but in the demo pin 0 is used
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi0");
|
|
||||||
check(spi_controller, "spi0 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -28,12 +29,18 @@
|
|||||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 0 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -23,21 +26,37 @@
|
|||||||
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
max-transfer-size = <65536>;
|
max-transfer-size = <65536>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_27);
|
driver::pwmbacklight::init(GPIO_NUM_27);
|
||||||
|
// Delay is required, or GUI will lock up.
|
||||||
|
// It's possibly related to the increased power draw when turning on the backlight.
|
||||||
|
vTaskDelay(100);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_5,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -23,21 +26,37 @@
|
|||||||
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 12 GPIO_FLAG_NONE>; // Touch
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
max-transfer-size = <65536>;
|
max-transfer-size = <65536>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
@@ -15,7 +13,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_10,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi0");
|
|
||||||
check(spi_controller, "spi0 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -28,12 +29,18 @@
|
|||||||
pin-scl = <&gpio0 20 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 20 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
@@ -9,7 +8,6 @@ using namespace tt::hal;
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard(),
|
|
||||||
createPower()
|
createPower()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/Logger.h>
|
|
||||||
#include <Tactility/Mutex.h>
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
#include <driver/sdmmc_defs.h>
|
|
||||||
#include <driver/sdmmc_host.h>
|
|
||||||
#include <esp_check.h>
|
|
||||||
#include <esp_ldo_regulator.h>
|
|
||||||
#include <esp_vfs_fat.h>
|
|
||||||
#include <sdmmc_cmd.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
static const auto LOGGER = tt::Logger("JcSdCard");
|
|
||||||
|
|
||||||
// ESP32-P4 Slot 0 uses IO MUX (fixed pins, not manually configurable)
|
|
||||||
// CLK=43, CMD=44, D0=39, D1=40, D2=41, D3=42 (defined automatically by hardware)
|
|
||||||
|
|
||||||
// TODO: Migrate to "espressif,esp32-sdmmc" driver (needs LDO code porting)
|
|
||||||
class SdCardDeviceImpl final : public SdCardDevice {
|
|
||||||
|
|
||||||
class NoLock final : public tt::Lock {
|
|
||||||
bool lock(TickType_t timeout) const override { return true; }
|
|
||||||
void unlock() const override { /* NO-OP */ }
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<tt::Lock> lock = std::make_shared<NoLock>();
|
|
||||||
sdmmc_card_t* card = nullptr;
|
|
||||||
bool mounted = false;
|
|
||||||
std::string mountPath;
|
|
||||||
|
|
||||||
public:
|
|
||||||
SdCardDeviceImpl() : SdCardDevice(MountBehaviour::AtBoot) {}
|
|
||||||
~SdCardDeviceImpl() override {
|
|
||||||
if (mounted) {
|
|
||||||
unmount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getName() const override { return "SD Card"; }
|
|
||||||
std::string getDescription() const override { return "SD card via SDMMC host"; }
|
|
||||||
|
|
||||||
bool mount(const std::string& newMountPath) override {
|
|
||||||
if (mounted) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
|
||||||
.format_if_mount_failed = false,
|
|
||||||
.max_files = 5,
|
|
||||||
.allocation_unit_size = 64 * 1024,
|
|
||||||
.disk_status_check_enable = false,
|
|
||||||
.use_one_fat = false,
|
|
||||||
};
|
|
||||||
|
|
||||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
|
||||||
host.slot = SDMMC_HOST_SLOT_0;
|
|
||||||
host.max_freq_khz = SDMMC_FREQ_DEFAULT; // 20MHz - more stable for initialization
|
|
||||||
host.flags = SDMMC_HOST_FLAG_4BIT; // Force 4-bit mode
|
|
||||||
// Configure LDO power supply for SD card (critical on ESP32-P4)
|
|
||||||
esp_ldo_channel_handle_t ldo_handle = nullptr;
|
|
||||||
esp_ldo_channel_config_t ldo_config = {
|
|
||||||
.chan_id = 4, // LDO channel 4 for SD power
|
|
||||||
.voltage_mv = 3300, // 3.3V
|
|
||||||
.flags {
|
|
||||||
.adjustable = 0,
|
|
||||||
.owned_by_hw = 0,
|
|
||||||
.bypass = 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
esp_err_t ldo_ret = esp_ldo_acquire_channel(&ldo_config, &ldo_handle);
|
|
||||||
if (ldo_ret != ESP_OK) {
|
|
||||||
LOGGER.warn("Failed to acquire LDO for SD power: {} (continuing anyway)", esp_err_to_name(ldo_ret));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Slot 0 uses IO MUX - pins are fixed and not specified
|
|
||||||
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
|
||||||
slot_config.width = 4;
|
|
||||||
slot_config.cd = SDMMC_SLOT_NO_CD; // No card detect
|
|
||||||
slot_config.wp = SDMMC_SLOT_NO_WP; // No write protect
|
|
||||||
slot_config.flags = 0;
|
|
||||||
|
|
||||||
esp_err_t ret = esp_vfs_fat_sdmmc_mount(newMountPath.c_str(), &host, &slot_config, &mount_config, &card);
|
|
||||||
if (ret != ESP_OK) {
|
|
||||||
LOGGER.error("Failed to mount SD card: {}", esp_err_to_name(ret));
|
|
||||||
card = nullptr;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mountPath = newMountPath;
|
|
||||||
mounted = true;
|
|
||||||
LOGGER.info("SD card mounted at {}", mountPath);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool unmount() override {
|
|
||||||
if (!mounted) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_err_t ret = esp_vfs_fat_sdcard_unmount(mountPath.c_str(), card);
|
|
||||||
if (ret != ESP_OK) {
|
|
||||||
LOGGER.error("Failed to unmount SD card: {}", esp_err_to_name(ret));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
card = nullptr;
|
|
||||||
mounted = false;
|
|
||||||
LOGGER.info("SD card unmounted");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getMountPath() const override {
|
|
||||||
return mountPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<tt::Lock> getLock() const override { return lock; }
|
|
||||||
|
|
||||||
State getState(TickType_t /*timeout*/) const override {
|
|
||||||
return mounted ? State::Mounted : State::Unmounted;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
return std::make_shared<SdCardDeviceImpl>();
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
// Create SD card device for jc1060p470ciwy using SDMMC slot 0 (4-bit)
|
|
||||||
std::shared_ptr<tt::hal::sdcard::SdCardDevice> createSdCard();
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
|
#include <tactility/bindings/esp32_sdmmc.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For future reference:
|
* For future reference:
|
||||||
@@ -44,4 +45,17 @@
|
|||||||
pin-data-in = <&gpio0 48 GPIO_FLAG_NONE>;
|
pin-data-in = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||||
pin-mclk = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mclk = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdmmc";
|
||||||
|
pin-clk = <&gpio0 43 GPIO_FLAG_NONE>;
|
||||||
|
pin-cmd = <&gpio0 44 GPIO_FLAG_NONE>;
|
||||||
|
pin-d0 = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
|
pin-d1 = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
|
pin-d2 = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||||
|
pin-d3 = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
|
slot = <SDMMC_HOST_SLOT_0>;
|
||||||
|
bus-width = <4>;
|
||||||
|
on-chip-ldo-chan = <4>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
@@ -24,7 +23,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
|
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -32,19 +34,30 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <Tactility/Logger.h>
|
#include <Tactility/Logger.h>
|
||||||
#include <Tactility/hal/touch/TouchDevice.h>
|
#include <Tactility/hal/touch/TouchDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Axs15231b/Axs15231bTouch.h>
|
#include <Axs15231b/Axs15231bTouch.h>
|
||||||
#include <EspLcdDisplayDriver.h>
|
#include <EspLcdDisplayDriver.h>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
@@ -10,7 +8,6 @@ using namespace tt::hal;
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_10;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
nullptr,
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SDCARD_SPI_HOST
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi1");
|
|
||||||
check(spi_controller, "spi1 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -45,22 +47,33 @@
|
|||||||
pin-data-out = <&gpio0 41 GPIO_FLAG_NONE>;
|
pin-data-out = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 45 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 21 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 48 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 47 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 47 GPIO_FLAG_NONE>;
|
||||||
pin-wp = <&gpio0 40 GPIO_FLAG_NONE>;
|
pin-wp = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
pin-hd = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-hd = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
|
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// P1 header
|
// P1 header
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
GPIO_NUM_10,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi0");
|
|
||||||
check(spi_controller, "spi0 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(config),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -49,9 +50,15 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard@0 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/KeyboardBacklight.h"
|
#include "devices/KeyboardBacklight.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include "devices/Sdcard.h"
|
|
||||||
#include "devices/TdeckKeyboard.h"
|
#include "devices/TdeckKeyboard.h"
|
||||||
#include "devices/TrackballDevice.h"
|
#include "devices/TrackballDevice.h"
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/device.h>
|
#include <tactility/device.h>
|
||||||
|
|
||||||
@@ -23,7 +21,6 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
|||||||
std::make_shared<TdeckKeyboard>(i2c_internal),
|
std::make_shared<TdeckKeyboard>(i2c_internal),
|
||||||
std::make_shared<KeyboardBacklightDevice>(),
|
std::make_shared<KeyboardBacklightDevice>(),
|
||||||
std::make_shared<TrackballDevice>(),
|
std::make_shared<TrackballDevice>(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
static const auto LOGGER = tt::Logger("T-Deck");
|
static const auto LOGGER = tt::Logger("T-Deck");
|
||||||
|
|
||||||
// Power on
|
|
||||||
constexpr auto TDECK_POWERON_GPIO = GPIO_NUM_10;
|
constexpr auto TDECK_POWERON_GPIO = GPIO_NUM_10;
|
||||||
|
|
||||||
static bool powerOn() {
|
static bool powerOn() {
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
#include "Sdcard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
constexpr auto TDECK_SDCARD_PIN_CS = GPIO_NUM_39;
|
|
||||||
constexpr auto TDECK_LCD_PIN_CS = GPIO_NUM_12;
|
|
||||||
constexpr auto TDECK_RADIO_PIN_CS = GPIO_NUM_9;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
TDECK_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector {
|
|
||||||
TDECK_RADIO_PIN_CS,
|
|
||||||
TDECK_LCD_PIN_CS
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
::Device* spiController = device_find_by_name("spi0");
|
|
||||||
check(spiController != nullptr, "spi0 not found");
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spiController
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
// Reference: https://wiki.lilygo.cc/get_started/en/Wearable/T-Deck-Plus/T-Deck-Plus.html#Pin-Overview
|
// Reference: https://wiki.lilygo.cc/get_started/en/Wearable/T-Deck-Plus/T-Deck-Plus.html#Pin-Overview
|
||||||
/ {
|
/ {
|
||||||
@@ -42,9 +44,22 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 12 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 39 GPIO_FLAG_NONE>, // SD card
|
||||||
|
<&gpio0 9 GPIO_FLAG_NONE>; // Radio
|
||||||
pin-mosi = <&gpio0 41 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 38 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 38 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
|
|
||||||
|
sdcard@1 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
status = "disabled"; // Must be started after display
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_ble.h>
|
#include <tactility/bindings/esp32_ble.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -18,11 +16,4 @@
|
|||||||
compatible = "espressif,esp32-gpio";
|
compatible = "espressif,esp32-gpio";
|
||||||
gpio-count = <49>;
|
gpio-count = <49>;
|
||||||
};
|
};
|
||||||
|
|
||||||
spi0 {
|
|
||||||
compatible = "espressif,esp32-spi";
|
|
||||||
host = <SPI2_HOST>;
|
|
||||||
pin-mosi = <&gpio0 7 GPIO_FLAG_NONE>;
|
|
||||||
pin-sclk = <&gpio0 6 GPIO_FLAG_NONE>;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -17,7 +18,12 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <tactility/bindings/esp32_sdmmc.h>
|
#include <tactility/bindings/esp32_sdmmc.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -32,8 +33,13 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdmmc0 {
|
sdmmc0 {
|
||||||
@@ -44,6 +50,7 @@
|
|||||||
pin-d1 = <&gpio0 17 GPIO_FLAG_NONE>;
|
pin-d1 = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||||
pin-d2 = <&gpio0 21 GPIO_FLAG_NONE>;
|
pin-d2 = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
pin-d3 = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-d3 = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
slot = <SDMMC_HOST_SLOT_1>;
|
||||||
bus-width = <4>;
|
bus-width = <4>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_sdmmc.h>
|
#include <tactility/bindings/esp32_sdmmc.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
#include <tactility/bindings/touch_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@@ -23,16 +25,28 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 6 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 2 GPIO_FLAG_NONE>; // Touch
|
||||||
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 1 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 1 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
|
|
||||||
|
touch@1 {
|
||||||
|
compatible = "touch-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdmmc0 {
|
sdmmc0 {
|
||||||
compatible = "espressif,esp32-sdmmc";
|
compatible = "espressif,esp32-sdmmc";
|
||||||
|
status = "disabled"; // Late-init is required, otherwise mounting fails
|
||||||
pin-clk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-clk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
|
slot = <SDMMC_HOST_SLOT_1>;
|
||||||
bus-width = <1>;
|
bus-width = <1>;
|
||||||
pullups;
|
pullups;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/TpagerEncoder.h"
|
#include "devices/TpagerEncoder.h"
|
||||||
#include "devices/TpagerKeyboard.h"
|
#include "devices/TpagerKeyboard.h"
|
||||||
#include "devices/TpagerPower.h"
|
#include "devices/TpagerPower.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
#include <tactility/device.h>
|
#include <tactility/device.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@@ -28,7 +26,6 @@ static DeviceVector createDevices() {
|
|||||||
bq27220,
|
bq27220,
|
||||||
std::make_shared<Drv2605>(i2c),
|
std::make_shared<Drv2605>(i2c),
|
||||||
power,
|
power,
|
||||||
createTpagerSdCard(),
|
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
keyboard,
|
keyboard,
|
||||||
std::make_shared<TpagerEncoder>()
|
std::make_shared<TpagerEncoder>()
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
constexpr auto TPAGER_SDCARD_PIN_CS = GPIO_NUM_21;
|
|
||||||
constexpr auto TPAGER_LCD_PIN_CS = GPIO_NUM_38;
|
|
||||||
constexpr auto TPAGER_RADIO_PIN_CS = GPIO_NUM_36;
|
|
||||||
constexpr auto TPAGER_NFC_PIN_CS = GPIO_NUM_39;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createTpagerSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
TPAGER_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector {
|
|
||||||
TPAGER_RADIO_PIN_CS,
|
|
||||||
TPAGER_LCD_PIN_CS,
|
|
||||||
TPAGER_NFC_PIN_CS
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
auto* spi_controller = device_find_by_name("spi0");
|
|
||||||
check(spi_controller, "spi0 not found");
|
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
|
||||||
std::move(configuration),
|
|
||||||
spi_controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createTpagerSdCard();
|
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
// Reference: https://wiki.lilygo.cc/get_started/en/LoRa_GPS/T-LoraPager/T-LoraPager.html#Pin-Overview
|
// Reference: https://wiki.lilygo.cc/get_started/en/LoRa_GPS/T-LoraPager/T-LoraPager.html#Pin-Overview
|
||||||
/ {
|
/ {
|
||||||
@@ -33,9 +35,21 @@
|
|||||||
spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
|
cs-gpios = <&gpio0 36 GPIO_FLAG_NONE>, // Display
|
||||||
|
<&gpio0 21 GPIO_FLAG_NONE>; // SD card
|
||||||
pin-mosi = <&gpio0 34 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 34 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 35 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 35 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display@0 {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
|
|
||||||
|
sdcard@1 {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
status = "disabled"; // Must be started after display
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// ES8311
|
// ES8311
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user