Skip to content

Commit cc0b6b6

Browse files
authored
feat(m5stack-tab5): Add Board Support Package (BSP) component for the M5Stack Tab5 development kit (#545)
* feat(m5stacktab5): Adding BSP component for M5StackTab5 * wip * minor fix * continuing to work on m5stack tab5 * update example * wip: working touch and partially working display! * working display code * mionr fix * wip * feat(m5stacktab5): Adding BSP component for M5StackTab5 * wip * minor fix * continuing to work on m5stack tab5 * update example * wip: working touch and partially working display! * working display code * mionr fix * wip * wip proper display initialization with just esp_lcd, not esp_lcd_ili9881 * cleaning up some * minor cleanup * working on display rotation and proper gravity vector * wip using sw rotation to rotate the display * fix sdkconfig for dark theme * wip updating display drivers accordingly * doc: update; ci: update * minor update * improve demos/apis some * wip trying to get sound working * remove unused def * wip getting audio working * wip * add support for uSD (via sdmmc/sdio) card to m5stack tab5 bsp * more fixes to audio and cleanup of m5 code * add rtc support * fix sa * fix suppression location * remove unused variable * cleanup * remove debug code for my slightly broken hardware * cleanup * further updates * remove text copied from another example about home button
1 parent f709a3d commit cc0b6b6

32 files changed

+3483
-26
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ jobs:
123123
target: esp32
124124
- path: 'components/lsm6dso/example'
125125
target: esp32s3
126+
- path: 'components/m5stack-tab5/example'
127+
target: esp32p4
126128
- path: 'components/math/example'
127129
target: esp32
128130
- path: 'components/matouch-rotary-display/example'

.github/workflows/upload_components.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ jobs:
8282
components/logger
8383
components/lp5817
8484
components/lsm6dso
85+
components/m5stack-tab5
8586
components/math
8687
components/matouch-rotary-display
8788
components/max1704x

components/display_drivers/include/display_drivers.hpp

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
#pragma once
22

3+
#include <mutex>
4+
#include <thread>
5+
6+
#include <driver/gpio.h>
7+
#include <esp_lcd_panel_commands.h>
8+
39
#include "display.hpp"
4-
#include "driver/gpio.h"
5-
#include "esp_lcd_panel_commands.h"
610

711
namespace espp {
812
namespace display_drivers {
913
/**
1014
* @brief Low-level callback to write bytes to the display controller.
1115
* @param command to write
1216
* @param parameters The command parameters to write
13-
* @param user_data User data associated with this transfer, used for flags.
17+
* @param flags User data associated with this transfer, used for flags.
1418
*/
15-
typedef std::function<void(uint8_t command, std::span<const uint8_t> parameters,
16-
uint32_t user_data)>
19+
typedef std::function<void(uint8_t command, std::span<const uint8_t> parameters, uint32_t flags)>
1720
write_command_fn;
1821

22+
/**
23+
* @brief Low-level callback to read bytes from the display controller.
24+
* @param command to read
25+
* @param data Span to store the read data.
26+
* @param flags User data associated with this transfer, used for flags.
27+
*/
28+
typedef std::function<void(uint8_t command, std::span<uint8_t> data, uint32_t flags)>
29+
read_command_fn;
30+
1931
/**
2032
* @brief Send color data to the display, with optional flags.
2133
* @param sx The starting x-coordinate of the area to fill.
@@ -35,14 +47,19 @@ typedef std::function<void(int sx, int sy, int ex, int ey, const uint8_t *color_
3547
*/
3648
struct Config {
3749
write_command_fn write_command; /**< Function which the display driver uses to write commands to
38-
the display. */
39-
send_lines_fn lcd_send_lines; /**< Function which the display driver uses to send bulk (color)
40-
data (non-blocking) to be written to the display. */
50+
the display. */
51+
read_command_fn read_command{
52+
nullptr}; /**< Function which the display driver uses to read commands from
53+
the display. Optional, may be nullptr if not supported. */
54+
send_lines_fn lcd_send_lines; /**< Function which the display driver uses to send bulk (color)
55+
data (non-blocking) to be written to the display. Optional, may
56+
be nullptr. */
4157
gpio_num_t reset_pin{GPIO_NUM_NC}; /**< Optional GPIO used for resetting the display. */
4258
gpio_num_t data_command_pin{GPIO_NUM_NC}; /**< Optional GPIO used for indicating to the LCD
4359
whether the bits are data or command bits. */
4460
bool reset_value{false}; /**< The value to set the reset pin to when resetting the display (low to
45-
reset default). */
61+
reset default). */
62+
uint8_t bits_per_pixel{16}; /**< How many bits per pixel, e.g. [1, 8, 16, 18, 24, 32]*/
4663
bool invert_colors{false}; /**< Whether to invert the colors on the display. */
4764
bool swap_color_order{false}; /**< Whether to swap the color order (RGB/BGR) on the display. */
4865
int offset_x{0}; /**< X Gap / offset, in pixels. */
@@ -100,11 +117,14 @@ static void init_pins(gpio_num_t reset, gpio_num_t data_command, uint8_t reset_v
100117
gpio_output_pin_sel |= (1ULL << reset);
101118
}
102119

103-
gpio_config_t o_conf{.pin_bit_mask = gpio_output_pin_sel,
104-
.mode = GPIO_MODE_OUTPUT,
105-
.pull_up_en = GPIO_PULLUP_DISABLE,
106-
.pull_down_en = GPIO_PULLDOWN_DISABLE,
107-
.intr_type = GPIO_INTR_DISABLE};
120+
gpio_config_t o_conf {
121+
.pin_bit_mask = gpio_output_pin_sel, .mode = GPIO_MODE_OUTPUT,
122+
.pull_up_en = GPIO_PULLUP_DISABLE, .pull_down_en = GPIO_PULLDOWN_DISABLE,
123+
.intr_type = GPIO_INTR_DISABLE,
124+
#if SOC_GPIO_SUPPORT_PIN_HYS_FILTER
125+
.hys_ctrl_mode = GPIO_HYS_SOFT_DISABLE,
126+
#endif
127+
};
108128
ESP_ERROR_CHECK(gpio_config(&o_conf));
109129

110130
using namespace std::chrono_literals;

0 commit comments

Comments
 (0)