forked from xiaozhi/xiaozhi-esp32
feat: add new board esp-hi (#666)
* feat: add new board esp-hi * feat(esp-hi): update servo_dog_ctrl --------- Co-authored-by: Li Junru <lijunru@espressif.com> Co-authored-by: Xiaoxia <terrence@tenclass.com>
This commit is contained in:
54
main/boards/esp-hi/emoji_display.h
Normal file
54
main/boards/esp-hi/emoji_display.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "display/lcd_display.h"
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <esp_lcd_panel_io.h>
|
||||
#include <esp_lcd_panel_ops.h>
|
||||
#include "anim_player.h"
|
||||
#include "mmap_generate_emoji.h"
|
||||
|
||||
namespace anim {
|
||||
|
||||
class EmojiPlayer;
|
||||
|
||||
using FlushIoReadyCallback = std::function<bool(esp_lcd_panel_io_handle_t, esp_lcd_panel_io_event_data_t*, void*)>;
|
||||
using FlushCallback = std::function<void(anim_player_handle_t, int, int, int, int, const void*)>;
|
||||
|
||||
class EmojiPlayer {
|
||||
public:
|
||||
EmojiPlayer(esp_lcd_panel_handle_t panel, esp_lcd_panel_io_handle_t panel_io);
|
||||
~EmojiPlayer();
|
||||
|
||||
void StartPlayer(int aaf, bool repeat, int fps);
|
||||
void StopPlayer();
|
||||
|
||||
private:
|
||||
static bool OnFlushIoReady(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx);
|
||||
static void OnFlush(anim_player_handle_t handle, int x_start, int y_start, int x_end, int y_end, const void *color_data);
|
||||
|
||||
anim_player_handle_t player_handle_;
|
||||
mmap_assets_handle_t assets_handle_;
|
||||
};
|
||||
|
||||
class EmojiWidget : public Display {
|
||||
public:
|
||||
EmojiWidget(esp_lcd_panel_handle_t panel, esp_lcd_panel_io_handle_t panel_io);
|
||||
virtual ~EmojiWidget();
|
||||
|
||||
virtual void SetEmotion(const char* emotion) override;
|
||||
virtual void SetStatus(const char* status) override;
|
||||
anim::EmojiPlayer* GetPlayer()
|
||||
{
|
||||
return player_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
void InitializePlayer(esp_lcd_panel_handle_t panel, esp_lcd_panel_io_handle_t panel_io);
|
||||
virtual bool Lock(int timeout_ms = 0) override;
|
||||
virtual void Unlock() override;
|
||||
|
||||
std::unique_ptr<anim::EmojiPlayer> player_;
|
||||
};
|
||||
|
||||
} // namespace anim
|
||||
Reference in New Issue
Block a user