面包板增加触摸对话按钮,使用GPIO45

This commit is contained in:
Terrence
2024-12-03 09:43:41 +08:00
parent 436ff2b906
commit 064341c5ef
7 changed files with 21 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ class CompactMl307Board : public Ml307Board {
private:
i2c_master_bus_handle_t display_i2c_bus_;
Button boot_button_;
Button touch_button_;
Button volume_up_button_;
Button volume_down_button_;
SystemReset system_reset_;
@@ -40,6 +41,12 @@ private:
boot_button_.OnClick([this]() {
Application::GetInstance().ToggleChatState();
});
touch_button_.OnPressDown([this]() {
Application::GetInstance().StartListening();
});
touch_button_.OnPressUp([this]() {
Application::GetInstance().StopListening();
});
volume_up_button_.OnClick([this]() {
auto codec = GetAudioCodec();
@@ -77,6 +84,7 @@ private:
public:
CompactMl307Board() : Ml307Board(ML307_TX_PIN, ML307_RX_PIN, 4096),
boot_button_(BOOT_BUTTON_GPIO),
touch_button_(TOUCH_BUTTON_GPIO, 1),
volume_up_button_(VOLUME_UP_BUTTON_GPIO),
volume_down_button_(VOLUME_DOWN_BUTTON_GPIO),
system_reset_(RESET_NVS_BUTTON_GPIO, RESET_FACTORY_BUTTON_GPIO) {

View File

@@ -29,6 +29,7 @@
#define BUILTIN_LED_GPIO GPIO_NUM_48
#define BOOT_BUTTON_GPIO GPIO_NUM_0
#define TOUCH_BUTTON_GPIO GPIO_NUM_45
#define VOLUME_UP_BUTTON_GPIO GPIO_NUM_40
#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_39
#define RESET_NVS_BUTTON_GPIO GPIO_NUM_1