2026-01-08 09:18:20 +08:00
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*/
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "stackchan_camera.h"
|
2026-05-07 16:33:29 +08:00
|
|
|
#include <cstdint>
|
2026-01-08 09:18:20 +08:00
|
|
|
#include <lvgl.h>
|
|
|
|
|
#include <driver/i2c_master.h>
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
|
|
namespace hal_bridge {
|
|
|
|
|
|
|
|
|
|
struct TouchPoint_t {
|
|
|
|
|
int num = 0;
|
|
|
|
|
int x = -1;
|
|
|
|
|
int y = -1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Data_t {
|
|
|
|
|
TouchPoint_t touchPoint;
|
2026-03-25 11:11:14 +08:00
|
|
|
bool isXiaozhiMode = false;
|
|
|
|
|
bool isXiaozhiModeToggleEnabled = false;
|
2026-01-08 09:18:20 +08:00
|
|
|
};
|
|
|
|
|
|
2026-05-07 16:33:29 +08:00
|
|
|
struct XiaozhiConfig_t {
|
|
|
|
|
uint32_t idleShutdownTimeSeconds = 600;
|
|
|
|
|
bool allowShutdownWhenCharging = false;
|
2026-05-12 10:34:39 +08:00
|
|
|
uint8_t idleRandomMovementLevel = 2;
|
2026-05-07 16:33:29 +08:00
|
|
|
};
|
|
|
|
|
|
2026-01-08 09:18:20 +08:00
|
|
|
void lock();
|
|
|
|
|
void unlock();
|
|
|
|
|
Data_t& get_data();
|
|
|
|
|
|
|
|
|
|
void set_touch_point(int num, int x, int y);
|
|
|
|
|
TouchPoint_t get_touch_point();
|
|
|
|
|
|
|
|
|
|
bool is_xiaozhi_mode();
|
|
|
|
|
void set_xiaozhi_mode(bool mode);
|
2026-03-25 11:11:14 +08:00
|
|
|
void toggle_xiaozhi_chat_state();
|
2026-01-08 09:18:20 +08:00
|
|
|
|
|
|
|
|
void disply_lvgl_lock();
|
|
|
|
|
void disply_lvgl_unlock();
|
|
|
|
|
lv_disp_t* display_get_lvgl_display();
|
|
|
|
|
|
|
|
|
|
void xiaozhi_board_init();
|
|
|
|
|
void start_xiaozhi_app();
|
2026-03-25 11:11:14 +08:00
|
|
|
bool is_xiaozhi_ready();
|
2026-05-07 09:38:14 +08:00
|
|
|
bool is_xiaozhi_idle();
|
2026-05-07 16:33:29 +08:00
|
|
|
XiaozhiConfig_t get_xiaozhi_config();
|
|
|
|
|
void set_xiaozhi_config(const XiaozhiConfig_t& config);
|
2026-01-08 09:18:20 +08:00
|
|
|
|
|
|
|
|
i2c_master_bus_handle_t board_get_i2c_bus();
|
|
|
|
|
StackChanCamera* board_get_camera();
|
2026-03-25 11:11:14 +08:00
|
|
|
int board_get_battery_level();
|
|
|
|
|
bool board_is_battery_charging();
|
|
|
|
|
void board_set_backlight_brightness(uint8_t brightness, bool permanent = false);
|
|
|
|
|
uint8_t board_get_backlight_brightness();
|
2026-04-20 16:27:36 +08:00
|
|
|
void board_set_speaker_volume(uint8_t volume, bool permanent = false);
|
|
|
|
|
uint8_t board_get_speaker_volume();
|
2026-01-08 09:18:20 +08:00
|
|
|
|
|
|
|
|
void app_play_sound(const std::string_view& sound);
|
|
|
|
|
|
|
|
|
|
} // namespace hal_bridge
|