Skip to content

Commit

Permalink
feat(examples): update arduino Phone
Browse files Browse the repository at this point in the history
  • Loading branch information
Lzw655 committed Dec 23, 2024
1 parent bf949c3 commit 1a4ffbb
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 137 deletions.
2 changes: 1 addition & 1 deletion docs/how_to_use.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Users can access them by navigating to `File` > `Examples` > `esp-brookesia` in

Here are examples of using esp-brookesia on the Arduino development platform:

- [ESP_Brookesia_Phone](../examples/arduino/ESP_Brookesia_Phone): This example demonstrates how to run the Phone UI using the [ESP32_Display_Panel](https://github.com/esp-arduino-libs/ESP32_Display_Panel) library.
- [Phone](../examples/arduino/Phone): This example demonstrates how to run the Phone UI using the [ESP32_Display_Panel](https://github.com/esp-arduino-libs/ESP32_Display_Panel) library.

## App Development

Expand Down
2 changes: 1 addition & 1 deletion docs/how_to_use_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ idf.py add-dependency "espressif/esp-brookesia"

以下是在 Arduino 开发平台下使用 esp-brookesia 的示例:

- [ESP_Brookesia_Phone](../examples/arduino/ESP_Brookesia_Phone): 此示例演示了如何使用 [ESP32_Display_Panel](https://github.com/esp-arduino-libs/ESP32_Display_Panel) 库运行 Phone UI。
- [Phone](../examples/arduino/Phone): 此示例演示了如何使用 [ESP32_Display_Panel](https://github.com/esp-arduino-libs/ESP32_Display_Panel) 库运行 Phone UI。

## App 开发

Expand Down
50 changes: 33 additions & 17 deletions examples/arduino/Phone/ESP_Panel_Board_Custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* - EK9716B
* - GC9A01, GC9B71, GC9503
* - ILI9341
* - JD9365
* - NV3022B
* - SH8601
* - SPD2010
Expand Down Expand Up @@ -110,8 +111,6 @@
// |--------------|---------------|
#define ESP_PANEL_LCD_RGB_DATA_WIDTH (16) // | 8 | 16 |
#define ESP_PANEL_LCD_RGB_PIXEL_BITS (16) // | 24 | 16 |

#define ESP_PANEL_LCD_RGB_FRAME_BUF_NUM (1) // 1/2/3
#define ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE (0) // Bounce buffer size in bytes. This function is used to avoid screen drift.
// To enable the bounce buffer, set it to a non-zero value. Typically set to `ESP_PANEL_LCD_WIDTH * 10`
// The size of the Bounce Buffer must satisfy `width_of_lcd * height_of_lcd = size_of_buffer * N`,
Expand All @@ -121,7 +120,6 @@
#define ESP_PANEL_LCD_RGB_IO_DE (17) // -1 if not used
#define ESP_PANEL_LCD_RGB_IO_PCLK (9)
#define ESP_PANEL_LCD_RGB_IO_DISP (-1) // -1 if not used

// | RGB565 | RGB666 | RGB888 |
// |--------|--------|--------|
#define ESP_PANEL_LCD_RGB_IO_DATA0 (10) // | B0 | B0-1 | B0-3 |
Expand Down Expand Up @@ -158,6 +156,22 @@
// The `mirror()` function will be implemented by LCD command if set to 1.
#endif

#elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_MIPI_DSI

#define ESP_PANEL_LCD_MIPI_DSI_LANE_NUM (2) // ESP32-P4 supports 1 or 2 lanes
#define ESP_PANEL_LCD_MIPI_DSI_LANE_RATE_MBPS (1000) // Single lane bit rate, should consult the LCD supplier or check the
// LCD drive IC datasheet for the supported lane rate.
// ESP32-P4 supports max 1500Mbps
#define ESP_PANEL_LCD_MIPI_DSI_PHY_LDO_ID (3) // -1 if not used
#define ESP_PANEL_LCD_MIPI_DPI_CLK_MHZ (52)
#define ESP_PANEL_LCD_MIPI_DPI_PIXEL_BITS (ESP_PANEL_LCD_RGB565_COLOR_BITS_16)
#define ESP_PANEL_LCD_MIPI_DSI_HPW (10)
#define ESP_PANEL_LCD_MIPI_DSI_HBP (160)
#define ESP_PANEL_LCD_MIPI_DSI_HFP (160)
#define ESP_PANEL_LCD_MIPI_DSI_VPW (1)
#define ESP_PANEL_LCD_MIPI_DSI_VBP (23)
#define ESP_PANEL_LCD_MIPI_DSI_VFP (12)

#else

#error "The function is not ready and will be implemented in the future."
Expand All @@ -176,18 +190,20 @@
* 2. Formatter: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and
* ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command)
*/
// #define ESP_PANEL_LCD_VENDOR_INIT_CMD() \
// { \
// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \
// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \
// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \
// {0x29, (uint8_t []){0x00}, 0, 120}, \
// or \
// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \
// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \
// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \
// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \
// }
/*
#define ESP_PANEL_LCD_VENDOR_INIT_CMD() \
{ \
{0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \
{0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \
{0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \
{0x29, (uint8_t []){0x00}, 0, 120}, \
or \
ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \
ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \
ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \
ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \
}
*/

/* LCD Color Settings */
/* LCD color depth in bits */
Expand Down Expand Up @@ -378,8 +394,8 @@
*
*/
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 2
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 2
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 3
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 1

#endif /* ESP_PANEL_USE_CUSTOM_BOARD */

Expand Down
32 changes: 23 additions & 9 deletions examples/arduino/Phone/ESP_Panel_Board_Supported.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
* - BOARD_ESP32_S3_BOX_LITE (ESP32-S3-Box-Lite): https://github.com/espressif/esp-box/tree/master
* - BOARD_ESP32_S3_EYE (ESP32-S3-EYE): https://github.com/espressif/esp-who/blob/master/docs/en/get-started/ESP32-S3-EYE_Getting_Started_Guide.md
* - BOARD_ESP32_S3_KORVO_2 (ESP32-S3-Korvo-2): https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/user-guide-esp32-s3-korvo-2.html
* - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html
* - BOARD_ESP32_S3_LCD_EV_BOARD (ESP32-S3-LCD-EV-Board(v1.1-v1.4)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html
* - BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 (ESP32-S3-LCD-EV-Board(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html
* - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html
* - BOARD_ESP32_S3_LCD_EV_BOARD_2 (ESP32-S3-LCD-EV-Board-2(v1.1-v1.4))): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide_v1.4.html
* - BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 (ESP32-S3-LCD-EV-Board-2(v1.5)): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html
* - BOARD_ESP32_S3_USB_OTG (ESP32-S3-USB-OTG): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html
* - BOARD_ESP32_P4_FUNCTION_EV_BOARD (ESP32-P4-Function-EV-Board): https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32p4/esp32-p4-function-ev-board/index.html
*
*/
// #define BOARD_ESP32_C3_LCDKIT
Expand All @@ -45,6 +46,7 @@
// #define BOARD_ESP32_S3_LCD_EV_BOARD_2
// #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5
// #define BOARD_ESP32_S3_USB_OTG
// #define BOARD_ESP32_P4_FUNCTION_EV_BOARD

/*
* Elecrow (https://www.elecrow.com):
Expand All @@ -56,9 +58,9 @@
/*
* M5Stack (https://m5stack.com/):
*
* - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/zh_CN/core/core2
* - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/zh_CN/core/M5Dial
* - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/zh_CN/core/CoreS3
* - BOARD_M5STACK_M5CORE2 (M5STACK_M5CORE2): https://docs.m5stack.com/en/core/core2
* - BOARD_M5STACK_M5DIAL (M5STACK_M5DIAL): https://docs.m5stack.com/en/core/M5Dial
* - BOARD_M5STACK_M5CORES3 (M5STACK_M5CORES3): https://docs.m5stack.com/en/core/CoreS3
*/
// #define BOARD_M5STACK_M5CORE2
// #define BOARD_M5STACK_M5DIAL
Expand All @@ -77,11 +79,23 @@
/*
* Waveshare Supported Boards (https://www.waveshare.com/):
*
* - ESP32_S3_Touch_LCD_4_3:
* - https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm
*
* - BOARD_WAVESHARE_ESP32_S3_Touch_LCD_1_85 (ESP32_S3_Touch_LCD_1_85): https://www.waveshare.com/esp32-s3-touch-lcd-1.85.htm
* - BOARD_WAVESHARE_ESP32_S3_Touch_LCD_2_1 (ESP32_S3_Touch_LCD_2_1): https://www.waveshare.com/esp32-s3-touch-lcd-2.1.htm
* - BOARD_WAVESHARE_ESP32_S3_Touch_LCD_4_3 (ESP32_S3_Touch_LCD_4_3): https://www.waveshare.com/esp32-s3-touch-lcd-4.3.htm
* - BOARD_WAVESHARE_ESP32_S3_Touch_LCD_4_3_B (ESP32_S3_Touch_LCD_4_3_B): https://www.waveshare.com/esp32-s3-touch-lcd-4.3B.htm
* - BOARD_WAVESHARE_ESP32_S3_Touch_LCD_5 (ESP32_S3_Touch_LCD_5): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28117
* - BOARD_WAVESHARE_ESP32_S3_Touch_LCD_5_B (ESP32_S3_Touch_LCD_5_B): https://www.waveshare.com/esp32-s3-touch-lcd-5.htm?sku=28151
* - BOARD_WAVESHARE_ESP32_S3_Touch_LCD_7 (ESP32_S3_Touch_LCD_7): https://www.waveshare.com/esp32-s3-touch-lcd-7.htm
* - BOARD_WAVESHARE_ESP32_P4_NANO (ESP32_P4_NANO): https://www.waveshare.com/esp32-p4-nano.htm
*/
// #define BOARD_WAVESHARE_ESP32_S3_Touch_LCD_1_85
// #define BOARD_WAVESHARE_ESP32_S3_Touch_LCD_2_1
// #define BOARD_WAVESHARE_ESP32_S3_Touch_LCD_4_3
// #define BOARD_WAVESHARE_ESP32_S3_Touch_LCD_4_3_B
// #define BOARD_WAVESHARE_ESP32_S3_Touch_LCD_5
// #define BOARD_WAVESHARE_ESP32_S3_Touch_LCD_5_B
// #define BOARD_WAVESHARE_ESP32_S3_Touch_LCD_7
// #define BOARD_WAVESHARE_ESP32_P4_NANO

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////// File Version ///////////////////////////////////////////////////////////
Expand All @@ -98,7 +112,7 @@
*
*/
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 3
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 7
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0

#endif
17 changes: 10 additions & 7 deletions examples/arduino/Phone/Phone.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,29 @@
*
* To use this example, please firstly install the following dependent libraries:
*
* - ESP32_Display_Panel (0.1.*)
* - ESP32_Display_Panel (0.2.*)
* - ESP32_IO_Expander (0.1.*)
* - lvgl (>= v8.3.9, < v9)
*
* Then, follow the steps below to configure the libraries and upload the example:
*
* 1. For **esp-brookesia**:
*
* - [optional] Follow the [steps](../../../README.md#configuration-instructions-1) to configure the library.
* - [optional] Follow the [steps](https://github.com/espressif/esp-brookesia/blob/master/docs/how_to_use.md#configuration-instructions-1) to configure the library.
*
* 2. For **ESP32_Display_Panel**:
*
* - [optional] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#configuring-drivers) to configure drivers.
* - [mandatory] If using a supported development board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#using-supported-development-boards) to configure it.
* - [mandatory] If using a custom board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#using-custom-development-boards) to configure it.
* - [optional] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#configuring-drivers) to configure drivers if needed.
* - [mandatory] If using a supported development board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#using-supported-development-boards) to configure it.
* - [mandatory] If using a custom board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#using-custom-development-boards) to configure it.
*
* 3. For **lvgl**:
*
* - [optional] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#configuring-lvgl) to add *lv_conf.h* file and change the configurations.
* - [mandatory] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#configuring-lvgl) to add *lv_conf.h* file and change the configurations.
* - [mandatory] Enable the `LV_USE_SNAPSHOT` macro in the *lv_conf.h* file.
* - [optional] Modify the macros in the [lvgl_port_v8.h](./lvgl_port_v8.h) file to configure the lvgl porting parameters.
*
* 4. Navigate to the `Tools` menu in the Arduino IDE to choose a ESP board and configure its parameters. **Please ensure that the size of APP partition in the partition table is enough (e.g. 2 MB)**. For supported boards, please refter to [Configuring Supported Development Boards](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/Board_Instructions.md#recommended-configurations-in-the-arduino-ide)
* 4. Navigate to the `Tools` menu in the Arduino IDE to choose a ESP board and configure its parameters. **Please ensure that the size of APP partition in the partition table is enough (e.g. 4 MB)**. For supported boards, please refter to [Configuring Supported Development Boards](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#configuring-supported-development-boards)
* 5. Verify and upload the example to the ESP board.
*
* ## Technical Support and Feedback
Expand Down Expand Up @@ -65,6 +66,8 @@
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_320_480_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 480) && (ESP_PANEL_LCD_HEIGHT == 480)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_480_480_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 720) && (ESP_PANEL_LCD_HEIGHT == 1280)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_720_1280_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 800) && (ESP_PANEL_LCD_HEIGHT == 480)
#define EXAMPLE_ESP_BROOKESIA_PHONE_DARK_STYLESHEET() ESP_BROOKESIA_PHONE_800_480_DARK_STYLESHEET()
#elif (ESP_PANEL_LCD_WIDTH == 800) && (ESP_PANEL_LCD_HEIGHT == 1280)
Expand Down
13 changes: 7 additions & 6 deletions examples/arduino/Phone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ The example is suitable for touchscreens with a resolution of `240 x 240` or hig

To use this example, please firstly install the following dependent libraries:

- ESP32_Display_Panel (0.1.5)
- ESP32_Display_Panel (0.2.*)
- ESP32_IO_Expander (0.1.*)
- lvgl (>= v8.3.9, < v9)

Then, follow the steps below to configure the libraries and upload the example:
Expand All @@ -19,17 +20,17 @@ Then, follow the steps below to configure the libraries and upload the example:

2. For **ESP32_Display_Panel**:

- [optional] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#configuring-drivers) to configure drivers.
- [mandatory] If using a supported development board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#using-supported-development-boards) to configure it.
- [mandatory] If using a custom board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#using-custom-development-boards) to configure it.
- [optional] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#configuring-drivers) to configure drivers if needed.
- [mandatory] If using a supported development board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#using-supported-development-boards) to configure it.
- [mandatory] If using a custom board, follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#using-custom-development-boards) to configure it.

3. For **lvgl**:

- [optional] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel?tab=readme-ov-file#configuring-lvgl) to add *lv_conf.h* file and change the configurations.
- [mandatory] Follow the [steps](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#configuring-lvgl) to add *lv_conf.h* file and change the configurations.
- [mandatory] Enable the `LV_USE_SNAPSHOT` macro in the *lv_conf.h* file.
- [optional] Modify the macros in the [lvgl_port_v8.h](./lvgl_port_v8.h) file to configure the lvgl porting parameters.

4. Navigate to the `Tools` menu in the Arduino IDE to choose a ESP board and configure its parameters. **Please ensure that the size of APP partition in the partition table is enough (e.g. 2 MB)**. For supported boards, please refter to [Configuring Supported Development Boards](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/Board_Instructions.md#recommended-configurations-in-the-arduino-ide)
4. Navigate to the `Tools` menu in the Arduino IDE to choose a ESP board and configure its parameters. **Please ensure that the size of APP partition in the partition table is enough (e.g. 4 MB)**. For supported boards, please refter to [Configuring Supported Development Boards](https://github.com/esp-arduino-libs/ESP32_Display_Panel/blob/master/docs/How_To_Use.md#configuring-supported-development-boards)
5. Verify and upload the example to the ESP board.

## Technical Support and Feedback
Expand Down
Loading

0 comments on commit 1a4ffbb

Please sign in to comment.