-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from esp-cpp/feature/29-box-3-firmware-support
Feature: Firmware support for ESP32-S3-BOX-3
- Loading branch information
Showing
14 changed files
with
290 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
idf_component_register( | ||
INCLUDE_DIRS "include" | ||
SRC_DIRS "src" | ||
REQUIRES "driver" "heap" "fatfs" "esp_lcd" "esp_psram" "spi_flash" "nvs_flash" "codec" "display" "display_drivers" "mcp23x17" "input_drivers" "tt21100" "drv2605" "event_manager" "i2c" | ||
REQUIRES "driver" "heap" "fatfs" "esp_lcd" "esp_psram" "spi_flash" "nvs_flash" "codec" "display" "display_drivers" "mcp23x17" "input_drivers" "tt21100" "gt911" "drv2605" "event_manager" "i2c" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
menu "BOX Emulator HAL Configuration" | ||
|
||
choice | ||
prompt "Hardware Configuration" | ||
default HARDWARE_BOX | ||
help | ||
Select the dev-kit / hardware you're using. | ||
config HARDWARE_BOX | ||
bool "ESP BOX" | ||
config HARDWARE_BOX_3 | ||
bool "ESP BOX 3" | ||
config HARDWARE_TDECK | ||
bool "LILYGO T DECK" | ||
endchoice | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#pragma once | ||
|
||
#include "hal/spi_types.h" | ||
#include "driver/gpio.h" | ||
#include "driver/i2s_std.h" | ||
#include "driver/spi_master.h" | ||
|
||
#include "i2c.hpp" | ||
#include "st7789.hpp" | ||
#include "touchpad_input.hpp" | ||
#include "tt21100.hpp" | ||
|
||
namespace box_hal { | ||
|
||
static constexpr std::string_view dev_kit = "ESP32-S3-BOX"; | ||
|
||
// internal i2c (touchscreen, audio codec) | ||
static constexpr auto internal_i2c_port = I2C_NUM_0; | ||
static constexpr auto internal_i2c_clock_speed = 400 * 1000; | ||
static constexpr gpio_num_t internal_i2c_sda = GPIO_NUM_8; | ||
static constexpr gpio_num_t internal_i2c_scl = GPIO_NUM_18; | ||
|
||
// external I2c (peripherals) | ||
static constexpr auto external_i2c_port = I2C_NUM_1; | ||
static constexpr auto external_i2c_clock_speed = 400 * 1000; | ||
static constexpr gpio_num_t external_i2c_sda = GPIO_NUM_41; | ||
static constexpr gpio_num_t external_i2c_scl = GPIO_NUM_40; | ||
|
||
// LCD | ||
static constexpr int lcd_clock_speed = 60 * 1000 * 1000; | ||
static constexpr auto lcd_spi_num = SPI2_HOST; | ||
static constexpr gpio_num_t lcd_cs = GPIO_NUM_5; | ||
static constexpr gpio_num_t lcd_mosi = GPIO_NUM_6; | ||
static constexpr gpio_num_t lcd_sclk = GPIO_NUM_7; | ||
static constexpr gpio_num_t lcd_reset = GPIO_NUM_48; | ||
static constexpr gpio_num_t lcd_dc = GPIO_NUM_4; | ||
static constexpr gpio_num_t backlight = GPIO_NUM_45; | ||
static constexpr size_t display_width = 320; | ||
static constexpr size_t display_height = 240; | ||
static constexpr bool backlight_value = true; | ||
static constexpr bool reset_value = false; | ||
static constexpr bool invert_colors = true; | ||
static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE; | ||
static constexpr bool mirror_x = true; | ||
static constexpr bool mirror_y = true; | ||
using DisplayDriver = espp::St7789; | ||
|
||
// touch | ||
static constexpr bool touch_swap_xy = false; | ||
static constexpr bool touch_invert_x = true; | ||
static constexpr bool touch_invert_y = false; | ||
static constexpr gpio_num_t touch_interrupt = GPIO_NUM_3; | ||
using TouchDriver = espp::Tt21100; | ||
#define TOUCH_DRIVER_USE_WRITE 0 | ||
#define TOUCH_DRIVER_USE_READ 1 | ||
#define TOUCH_DRIVER_USE_WRITE_READ 0 | ||
|
||
// sound | ||
static constexpr gpio_num_t sound_power_pin = GPIO_NUM_46; | ||
static constexpr auto i2s_port = I2S_NUM_0; | ||
static constexpr gpio_num_t i2s_mck_io = GPIO_NUM_2; | ||
static constexpr gpio_num_t i2s_bck_io = GPIO_NUM_17; | ||
static constexpr gpio_num_t i2s_ws_io = GPIO_NUM_47; | ||
static constexpr gpio_num_t i2s_do_io = GPIO_NUM_15; | ||
static constexpr gpio_num_t i2s_di_io = GPIO_NUM_16; | ||
static constexpr gpio_num_t mute_pin = GPIO_NUM_1; | ||
|
||
// uSD card | ||
static constexpr gpio_num_t sdcard_cs = GPIO_NUM_10; | ||
static constexpr gpio_num_t sdcard_mosi = GPIO_NUM_11; | ||
static constexpr gpio_num_t sdcard_miso = GPIO_NUM_13; | ||
static constexpr gpio_num_t sdcard_sclk = GPIO_NUM_12; | ||
static constexpr auto sdcard_spi_num = SPI3_HOST; | ||
|
||
} // namespace box_hal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#pragma once | ||
|
||
#include "hal/spi_types.h" | ||
#include "driver/gpio.h" | ||
#include "driver/i2s_std.h" | ||
#include "driver/spi_master.h" | ||
|
||
#include "i2c.hpp" | ||
#include "st7789.hpp" | ||
#include "touchpad_input.hpp" | ||
#include "gt911.hpp" | ||
|
||
namespace box_hal { | ||
|
||
static constexpr std::string_view dev_kit = "ESP32-S3-BOX-3"; | ||
|
||
// internal i2c (touchscreen, audio codec) | ||
static constexpr auto internal_i2c_port = I2C_NUM_0; | ||
static constexpr auto internal_i2c_clock_speed = 400 * 1000; | ||
static constexpr gpio_num_t internal_i2c_sda = GPIO_NUM_8; | ||
static constexpr gpio_num_t internal_i2c_scl = GPIO_NUM_18; | ||
|
||
// external I2c (peripherals) | ||
static constexpr auto external_i2c_port = I2C_NUM_1; | ||
static constexpr auto external_i2c_clock_speed = 400 * 1000; | ||
static constexpr gpio_num_t external_i2c_sda = GPIO_NUM_41; | ||
static constexpr gpio_num_t external_i2c_scl = GPIO_NUM_40; | ||
|
||
// LCD | ||
static constexpr int lcd_clock_speed = 60 * 1000 * 1000; | ||
static constexpr auto lcd_spi_num = SPI2_HOST; | ||
static constexpr gpio_num_t lcd_cs = GPIO_NUM_5; | ||
static constexpr gpio_num_t lcd_mosi = GPIO_NUM_6; | ||
static constexpr gpio_num_t lcd_sclk = GPIO_NUM_7; | ||
static constexpr gpio_num_t lcd_reset = GPIO_NUM_48; | ||
static constexpr gpio_num_t lcd_dc = GPIO_NUM_4; | ||
static constexpr gpio_num_t backlight = GPIO_NUM_47; // was 45 on ESP32-S3-BOX | ||
static constexpr size_t display_width = 320; | ||
static constexpr size_t display_height = 240; | ||
static constexpr bool backlight_value = true; | ||
static constexpr bool reset_value = true; // was false on ESP32-S3-BOX | ||
static constexpr bool invert_colors = true; | ||
static constexpr auto rotation = espp::Display::Rotation::LANDSCAPE; | ||
static constexpr bool mirror_x = true; | ||
static constexpr bool mirror_y = true; | ||
using DisplayDriver = espp::St7789; | ||
|
||
// touch | ||
static constexpr bool touch_swap_xy = false; | ||
static constexpr bool touch_invert_x = false; | ||
static constexpr bool touch_invert_y = false; | ||
static constexpr gpio_num_t touch_interrupt = GPIO_NUM_3; | ||
using TouchDriver = espp::Gt911; | ||
#define TOUCH_DRIVER_USE_WRITE 1 | ||
#define TOUCH_DRIVER_USE_READ 0 | ||
#define TOUCH_DRIVER_USE_WRITE_READ 1 | ||
|
||
// sound | ||
static constexpr gpio_num_t sound_power_pin = GPIO_NUM_46; | ||
static constexpr auto i2s_port = I2S_NUM_0; | ||
static constexpr gpio_num_t i2s_mck_io = GPIO_NUM_2; | ||
static constexpr gpio_num_t i2s_bck_io = GPIO_NUM_17; | ||
static constexpr gpio_num_t i2s_ws_io = GPIO_NUM_45; // was 47 on ESP32-S3-BOX | ||
static constexpr gpio_num_t i2s_do_io = GPIO_NUM_15; | ||
static constexpr gpio_num_t i2s_di_io = GPIO_NUM_16; | ||
static constexpr gpio_num_t mute_pin = GPIO_NUM_1; | ||
|
||
// uSD card | ||
static constexpr gpio_num_t sdcard_cs = GPIO_NUM_10; | ||
static constexpr gpio_num_t sdcard_mosi = GPIO_NUM_11; | ||
static constexpr gpio_num_t sdcard_miso = GPIO_NUM_13; | ||
static constexpr gpio_num_t sdcard_sclk = GPIO_NUM_12; | ||
static constexpr auto sdcard_spi_num = SPI3_HOST; | ||
|
||
} // namespace box_hal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,6 @@ | |
#include "sdmmc_cmd.h" | ||
#define MOUNT_POINT "/sdcard" | ||
|
||
#include "hal.hpp" | ||
|
||
void fs_init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
#include <sdkconfig.h> | ||
|
||
#if defined(CONFIG_HARDWARE_BOX) | ||
#include "box.hpp" | ||
#elif defined(CONFIG_HARDWARE_BOX_3) | ||
#include "box_3.hpp" | ||
#else | ||
#error "Unsupported hardware configuration specified" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.