Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,42 @@ This project is built on the ESP32 IoT Development Framework (IDF) and utilizes
</a>
</p>

# SenseCAP Indicator – **idf5-port** (OpenAI demo)

This branch back-ports Seeed’s original **SenseCAP Indicator** firmware to
**ESP-IDF 5.4** and enables the new OpenAI demo app on the ESP32-S3.

| Feature | Status |
|---------|--------|
| ESP-IDF 5.4 tool-chain | ✔️ |
| OpenAI chat / sensor overlay | ✔️ |
| Wi-Fi WPA3 + BT classic/LE | ✔️ |
| New IDF HAL / driver layer | ✔️ |
| LoRa disabled* | 🔧 _(can be re-enabled later)_

\* The original LoRa driver doesn’t compile on IDF 5.x; a stubbed-out component
(`components/lora_disabled`) lets the build succeed.

---

## Quick start

```bash
# clone and switch to the ported branch
git clone https://github.com/pb-ancestor/SenseCAP_Indicator_ESP32.git
cd SenseCAP_Indicator_ESP32
git checkout idf5-port

# set up the ESP-IDF 5.4 environment
. $HOME/esp/esp-idf/export.sh # adjust path if different

# build & flash (replace PORT with your USB serial port)
cd examples/indicator_openai
idf.py set-target esp32s3
idf.py build
idf.py -p /dev/cu.usbserial-110 flash monitor


> Relevant: [SenseCAP Indicator RP2040](https://github.com/Seeed-Solution/SenseCAP_Indicator_RP2040) | [Share Your Projects HERE](https://github.com/Seeed-Solution/SenseCAP_Indicator_ESP32/discussions/33)

The project includes various examples that demonstrate how to effectively use ESP32 functions. To test the examples, the firmware is programmed onto the ESP32 microcontroller unit (MCU).
Expand Down
10 changes: 9 additions & 1 deletion components/bsp/src/boards/sensecap_indicator_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@ static const board_button_t g_btns[] = {
{BOARD_BTN_ID_USER, 0, GPIO_NUM_38, 0},
};

/* ===== Shim: adapt uint16_t* → uint8_t* =============================== */
static esp_err_t tca9535_read_input_pins_u8(uint8_t *val8)
{
/* Cast and call the real driver */
return tca9535_read_input_pins((uint16_t *)val8);
}


static const io_expander_ops_t g_board_lcd_evb_io_expander_ops = {
.init = tca9535_init,
.set_direction = tca9535_set_direction,
.set_level = tca9535_set_level,
.read_output_pins = NULL,
.read_input_pins = tca9535_read_input_pins,
.read_input_pins = tca9535_read_input_pins_u8,
.multi_write_start = tca9535_multi_write_start,
.multi_write_new_level = tca9535_multi_write_new_level,
.multi_write_end = tca9535_multi_write_end,
Expand Down
12 changes: 11 additions & 1 deletion components/bsp/src/calibration/touch_calibration.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
#include "bsp_lcd.h"
#include "basic_painter/basic_painter.h"

static void lcd_draw_bitmap(int x, int y, int w, int h, void *data);


static esp_err_t lcd_draw_bitmap_err(int x1, int y1, int x2, int y2,
const void *color)
{
lcd_draw_bitmap(x1, y1, x2, y2, color); // existing helper
return ESP_OK;
}

static const char* TAG = "Touch calibration";

#define CALIBRATION_CHECK(a, str, ret) if(!(a)) { \
Expand Down Expand Up @@ -221,7 +231,7 @@ esp_err_t touch_calibration_run(int (*func_is_pressed)(void),
g_touch_is_pressed = func_is_pressed;
g_touch_read_rawdata = func_read_rawdata;
painter_config_t config = {
.draw_bitmap = lcd_draw_bitmap,
.draw_bitmap = lcd_draw_bitmap_err,
.info.height = TOUCH_HEIGHT,
.info.width = TOUCH_WIDTH,
};
Expand Down
6 changes: 3 additions & 3 deletions components/bsp/src/peripherals/bsp_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void lcd_task(void *args);

#if CONFIG_LCD_LVGL_DIRECT_MODE
static bool (*lvgl_flush_is_end)(void) = NULL;
static bool (*lvgl_direct_mode_buf_copy)(void) = NULL;
static void (*lvgl_direct_mode_buf_copy)(void) = NULL;
#endif

static void *p_user_data = NULL;
Expand Down Expand Up @@ -80,7 +80,7 @@ static esp_err_t screen_clear(uint16_t color)

IRAM_ATTR static bool on_vsync_event(
esp_lcd_panel_handle_t panel,
esp_lcd_rgb_panel_event_data_t *edata,
const esp_lcd_rgb_panel_event_data_t *edata,
void *user_ctx
)
{
Expand Down Expand Up @@ -271,7 +271,7 @@ esp_err_t bsp_lcd_init(void)
#endif

#if CONFIG_LCD_AVOID_TEAR
esp_lcd_rgb_panel_get_frame_buffer(panel_handle, 2, &lcd_buf0, &lcd_buf1);
esp_lcd_rgb_panel_get_frame_buffer(panel_handle, 2,(void **)&lcd_buf0, (void **)&lcd_buf1);
trans_ready = xSemaphoreCreateBinary();
assert(trans_ready);
xSemaphoreGive(trans_ready);
Expand Down
2 changes: 1 addition & 1 deletion components/i2c_devices/touch_panel/gt911.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ int gt911_pos_read(uint16_t *xpos, uint16_t *ypos)
{
u8 key_value = 0;
struct goodix_point_t points[GTP_MAX_TOUCH_ID];
u8 finger_state = gtp_get_points(&g_ts_data, &points, &key_value);
u8 finger_state = gtp_get_points(&g_ts_data, points, &key_value);

if (finger_state & 0x0f) {
*xpos = points[0].x;
Expand Down
4 changes: 2 additions & 2 deletions components/i2c_devices/touch_panel/tt21100.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ esp_err_t tt21100_tp_init(void)

uint16_t reg_val = 0;
do {
tt21100_read(&reg_val, sizeof(reg_val));
tt21100_read((uint8_t *)&reg_val, sizeof(reg_val));
vTaskDelay(pdMS_TO_TICKS(20));
} while (0x0002 != reg_val);

Expand Down Expand Up @@ -115,7 +115,7 @@ esp_err_t tt21100_tp_read(void)
esp_err_t ret_val = ESP_OK;

/* Get report data length */
ret_val |= tt21100_read(&data_len, sizeof(data_len));
ret_val |= tt21100_read((uint8_t *)&data_len, sizeof(data_len));
ESP_LOGD(TAG, "Data len : %u", data_len);

/* Read report data if length */
Expand Down
Loading