Upgrade Playlist Features
This commit is contained in:
@@ -1,63 +1,63 @@
|
||||
#ifndef _BOARD_CONFIG_H_
|
||||
#define _BOARD_CONFIG_H_
|
||||
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#define AUDIO_INPUT_SAMPLE_RATE 16000
|
||||
#define AUDIO_OUTPUT_SAMPLE_RATE 24000
|
||||
|
||||
#define AUDIO_I2S_MIC_GPIO_SCK GPIO_NUM_38
|
||||
#define AUDIO_I2S_MIC_GPIO_DIN GPIO_NUM_39
|
||||
#define AUDIO_I2S_SPK_GPIO_DOUT GPIO_NUM_42
|
||||
#define AUDIO_I2S_SPK_GPIO_BCLK GPIO_NUM_45
|
||||
#define AUDIO_I2S_SPK_GPIO_LRCK GPIO_NUM_46
|
||||
#define AUDIO_I2S_SPK_GPIO_GAIN GPIO_NUM_41
|
||||
|
||||
#define BUILTIN_LED_GPIO GPIO_NUM_3
|
||||
#define BOOT_BUTTON_GPIO GPIO_NUM_0
|
||||
#define TOUCH_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define VOLUME_UP_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define RESET_NVS_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define RESET_FACTORY_BUTTON_GPIO GPIO_NUM_NC
|
||||
|
||||
/* DFRobot Camera pins */
|
||||
#define PWDN_GPIO_NUM -1
|
||||
#define RESET_GPIO_NUM -1
|
||||
#define XCLK_GPIO_NUM 5
|
||||
#define Y9_GPIO_NUM 4
|
||||
#define Y8_GPIO_NUM 6
|
||||
#define Y7_GPIO_NUM 7
|
||||
#define Y6_GPIO_NUM 14
|
||||
#define Y5_GPIO_NUM 17
|
||||
#define Y4_GPIO_NUM 21
|
||||
#define Y3_GPIO_NUM 18
|
||||
#define Y2_GPIO_NUM 16
|
||||
#define VSYNC_GPIO_NUM 1
|
||||
#define HREF_GPIO_NUM 2
|
||||
#define PCLK_GPIO_NUM 15
|
||||
#define SIOD_GPIO_NUM 8
|
||||
#define SIOC_GPIO_NUM 9
|
||||
|
||||
/* Camera pins */
|
||||
#define CAMERA_PIN_PWDN PWDN_GPIO_NUM
|
||||
#define CAMERA_PIN_RESET RESET_GPIO_NUM
|
||||
#define CAMERA_PIN_XCLK XCLK_GPIO_NUM
|
||||
#define CAMERA_PIN_SIOD SIOD_GPIO_NUM
|
||||
#define CAMERA_PIN_SIOC SIOC_GPIO_NUM
|
||||
|
||||
#define CAMERA_PIN_D7 Y9_GPIO_NUM
|
||||
#define CAMERA_PIN_D6 Y8_GPIO_NUM
|
||||
#define CAMERA_PIN_D5 Y7_GPIO_NUM
|
||||
#define CAMERA_PIN_D4 Y6_GPIO_NUM
|
||||
#define CAMERA_PIN_D3 Y5_GPIO_NUM
|
||||
#define CAMERA_PIN_D2 Y4_GPIO_NUM
|
||||
#define CAMERA_PIN_D1 Y3_GPIO_NUM
|
||||
#define CAMERA_PIN_D0 Y2_GPIO_NUM
|
||||
#define CAMERA_PIN_VSYNC VSYNC_GPIO_NUM
|
||||
#define CAMERA_PIN_HREF HREF_GPIO_NUM
|
||||
#define CAMERA_PIN_PCLK PCLK_GPIO_NUM
|
||||
|
||||
#define XCLK_FREQ_HZ 20000000
|
||||
|
||||
#endif // _BOARD_CONFIG_H_
|
||||
#ifndef _BOARD_CONFIG_H_
|
||||
#define _BOARD_CONFIG_H_
|
||||
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#define AUDIO_INPUT_SAMPLE_RATE 16000
|
||||
#define AUDIO_OUTPUT_SAMPLE_RATE 24000
|
||||
|
||||
#define AUDIO_I2S_MIC_GPIO_SCK GPIO_NUM_38
|
||||
#define AUDIO_I2S_MIC_GPIO_DIN GPIO_NUM_39
|
||||
#define AUDIO_I2S_SPK_GPIO_DOUT GPIO_NUM_42
|
||||
#define AUDIO_I2S_SPK_GPIO_BCLK GPIO_NUM_45
|
||||
#define AUDIO_I2S_SPK_GPIO_LRCK GPIO_NUM_46
|
||||
#define AUDIO_I2S_SPK_GPIO_GAIN GPIO_NUM_41
|
||||
|
||||
#define BUILTIN_LED_GPIO GPIO_NUM_3
|
||||
#define BOOT_BUTTON_GPIO GPIO_NUM_0
|
||||
#define TOUCH_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define VOLUME_UP_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define RESET_NVS_BUTTON_GPIO GPIO_NUM_NC
|
||||
#define RESET_FACTORY_BUTTON_GPIO GPIO_NUM_NC
|
||||
|
||||
/* DFRobot Camera pins */
|
||||
#define PWDN_GPIO_NUM -1
|
||||
#define RESET_GPIO_NUM -1
|
||||
#define XCLK_GPIO_NUM 5
|
||||
#define Y9_GPIO_NUM 4
|
||||
#define Y8_GPIO_NUM 6
|
||||
#define Y7_GPIO_NUM 7
|
||||
#define Y6_GPIO_NUM 14
|
||||
#define Y5_GPIO_NUM 17
|
||||
#define Y4_GPIO_NUM 21
|
||||
#define Y3_GPIO_NUM 18
|
||||
#define Y2_GPIO_NUM 16
|
||||
#define VSYNC_GPIO_NUM 1
|
||||
#define HREF_GPIO_NUM 2
|
||||
#define PCLK_GPIO_NUM 15
|
||||
#define SIOD_GPIO_NUM 8
|
||||
#define SIOC_GPIO_NUM 9
|
||||
|
||||
/* Camera pins */
|
||||
#define CAMERA_PIN_PWDN PWDN_GPIO_NUM
|
||||
#define CAMERA_PIN_RESET RESET_GPIO_NUM
|
||||
#define CAMERA_PIN_XCLK XCLK_GPIO_NUM
|
||||
#define CAMERA_PIN_SIOD SIOD_GPIO_NUM
|
||||
#define CAMERA_PIN_SIOC SIOC_GPIO_NUM
|
||||
|
||||
#define CAMERA_PIN_D7 Y9_GPIO_NUM
|
||||
#define CAMERA_PIN_D6 Y8_GPIO_NUM
|
||||
#define CAMERA_PIN_D5 Y7_GPIO_NUM
|
||||
#define CAMERA_PIN_D4 Y6_GPIO_NUM
|
||||
#define CAMERA_PIN_D3 Y5_GPIO_NUM
|
||||
#define CAMERA_PIN_D2 Y4_GPIO_NUM
|
||||
#define CAMERA_PIN_D1 Y3_GPIO_NUM
|
||||
#define CAMERA_PIN_D0 Y2_GPIO_NUM
|
||||
#define CAMERA_PIN_VSYNC VSYNC_GPIO_NUM
|
||||
#define CAMERA_PIN_HREF HREF_GPIO_NUM
|
||||
#define CAMERA_PIN_PCLK PCLK_GPIO_NUM
|
||||
|
||||
#define XCLK_FREQ_HZ 20000000
|
||||
|
||||
#endif // _BOARD_CONFIG_H_
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"target": "esp32s3",
|
||||
"builds": [
|
||||
{
|
||||
"name": "df-s3-ai-cam",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=10",
|
||||
"CONFIG_ESP_PHY_MAX_TX_POWER=10",
|
||||
"CONFIG_SPIRAM_MODE_OCT=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
{
|
||||
"target": "esp32s3",
|
||||
"builds": [
|
||||
{
|
||||
"name": "df-s3-ai-cam",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=10",
|
||||
"CONFIG_ESP_PHY_MAX_TX_POWER=10",
|
||||
"CONFIG_SPIRAM_MODE_OCT=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,91 +1,91 @@
|
||||
#include "wifi_board.h"
|
||||
#include "codecs/no_audio_codec.h"
|
||||
#include "system_reset.h"
|
||||
#include "application.h"
|
||||
#include "button.h"
|
||||
#include "config.h"
|
||||
#include "esp32_camera.h"
|
||||
|
||||
#include "led/gpio_led.h"
|
||||
#include <wifi_station.h>
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#define TAG "DfrobotEsp32S3AiCam"
|
||||
|
||||
class DfrobotEsp32S3AiCam : public WifiBoard {
|
||||
private:
|
||||
Button boot_button_;
|
||||
Esp32Camera* camera_;
|
||||
|
||||
void InitializeButtons() {
|
||||
boot_button_.OnClick([this]() {
|
||||
auto& app = Application::GetInstance();
|
||||
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
|
||||
ResetWifiConfiguration();
|
||||
}
|
||||
app.ToggleChatState();
|
||||
});
|
||||
}
|
||||
|
||||
void InitializeCamera() {
|
||||
camera_config_t config = {};
|
||||
config.ledc_channel = LEDC_CHANNEL_2; // LEDC通道选择 用于生成XCLK时钟 但是S3不用
|
||||
config.ledc_timer = LEDC_TIMER_2; // LEDC timer选择 用于生成XCLK时钟 但是S3不用
|
||||
config.pin_d0 = CAMERA_PIN_D0;
|
||||
config.pin_d1 = CAMERA_PIN_D1;
|
||||
config.pin_d2 = CAMERA_PIN_D2;
|
||||
config.pin_d3 = CAMERA_PIN_D3;
|
||||
config.pin_d4 = CAMERA_PIN_D4;
|
||||
config.pin_d5 = CAMERA_PIN_D5;
|
||||
config.pin_d6 = CAMERA_PIN_D6;
|
||||
config.pin_d7 = CAMERA_PIN_D7;
|
||||
config.pin_xclk = CAMERA_PIN_XCLK;
|
||||
config.pin_pclk = CAMERA_PIN_PCLK;
|
||||
config.pin_vsync = CAMERA_PIN_VSYNC;
|
||||
config.pin_href = CAMERA_PIN_HREF;
|
||||
config.pin_sccb_sda = CAMERA_PIN_SIOD; // 这里如果写-1 表示使用已经初始化的I2C接口
|
||||
config.pin_sccb_scl = CAMERA_PIN_SIOC;
|
||||
config.sccb_i2c_port = 1; // 这里如果写1 默认使用I2C1
|
||||
config.pin_pwdn = CAMERA_PIN_PWDN;
|
||||
config.pin_reset = CAMERA_PIN_RESET;
|
||||
config.xclk_freq_hz = XCLK_FREQ_HZ;
|
||||
config.pixel_format = PIXFORMAT_RGB565;
|
||||
config.frame_size = FRAMESIZE_VGA;
|
||||
config.jpeg_quality = 12;
|
||||
config.fb_count = 1;
|
||||
config.fb_location = CAMERA_FB_IN_PSRAM;
|
||||
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
|
||||
|
||||
camera_ = new Esp32Camera(config);
|
||||
camera_->SetVFlip(1);
|
||||
}
|
||||
|
||||
public:
|
||||
DfrobotEsp32S3AiCam() :
|
||||
boot_button_(BOOT_BUTTON_GPIO) {
|
||||
InitializeButtons();
|
||||
InitializeCamera();
|
||||
}
|
||||
|
||||
// Wakenet model only
|
||||
|
||||
virtual Led* GetLed() override {
|
||||
static GpioLed led(BUILTIN_LED_GPIO, 0);
|
||||
return &led;
|
||||
}
|
||||
|
||||
virtual AudioCodec* GetAudioCodec() override {
|
||||
static NoAudioCodecSimplexPdm audio_codec(AUDIO_INPUT_SAMPLE_RATE, AUDIO_OUTPUT_SAMPLE_RATE,
|
||||
AUDIO_I2S_SPK_GPIO_BCLK, AUDIO_I2S_SPK_GPIO_LRCK, AUDIO_I2S_SPK_GPIO_DOUT,
|
||||
AUDIO_I2S_MIC_GPIO_SCK, AUDIO_I2S_MIC_GPIO_DIN);
|
||||
return &audio_codec;
|
||||
}
|
||||
|
||||
virtual Camera* GetCamera() override {
|
||||
return camera_;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_BOARD(DfrobotEsp32S3AiCam);
|
||||
#include "wifi_board.h"
|
||||
#include "codecs/no_audio_codec.h"
|
||||
#include "system_reset.h"
|
||||
#include "application.h"
|
||||
#include "button.h"
|
||||
#include "config.h"
|
||||
#include "esp32_camera.h"
|
||||
|
||||
#include "led/gpio_led.h"
|
||||
#include <wifi_station.h>
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#define TAG "DfrobotEsp32S3AiCam"
|
||||
|
||||
class DfrobotEsp32S3AiCam : public WifiBoard {
|
||||
private:
|
||||
Button boot_button_;
|
||||
Esp32Camera* camera_;
|
||||
|
||||
void InitializeButtons() {
|
||||
boot_button_.OnClick([this]() {
|
||||
auto& app = Application::GetInstance();
|
||||
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
|
||||
ResetWifiConfiguration();
|
||||
}
|
||||
app.ToggleChatState();
|
||||
});
|
||||
}
|
||||
|
||||
void InitializeCamera() {
|
||||
camera_config_t config = {};
|
||||
config.ledc_channel = LEDC_CHANNEL_2; // LEDC通道选择 用于生成XCLK时钟 但是S3不用
|
||||
config.ledc_timer = LEDC_TIMER_2; // LEDC timer选择 用于生成XCLK时钟 但是S3不用
|
||||
config.pin_d0 = CAMERA_PIN_D0;
|
||||
config.pin_d1 = CAMERA_PIN_D1;
|
||||
config.pin_d2 = CAMERA_PIN_D2;
|
||||
config.pin_d3 = CAMERA_PIN_D3;
|
||||
config.pin_d4 = CAMERA_PIN_D4;
|
||||
config.pin_d5 = CAMERA_PIN_D5;
|
||||
config.pin_d6 = CAMERA_PIN_D6;
|
||||
config.pin_d7 = CAMERA_PIN_D7;
|
||||
config.pin_xclk = CAMERA_PIN_XCLK;
|
||||
config.pin_pclk = CAMERA_PIN_PCLK;
|
||||
config.pin_vsync = CAMERA_PIN_VSYNC;
|
||||
config.pin_href = CAMERA_PIN_HREF;
|
||||
config.pin_sccb_sda = CAMERA_PIN_SIOD; // 这里如果写-1 表示使用已经初始化的I2C接口
|
||||
config.pin_sccb_scl = CAMERA_PIN_SIOC;
|
||||
config.sccb_i2c_port = 1; // 这里如果写1 默认使用I2C1
|
||||
config.pin_pwdn = CAMERA_PIN_PWDN;
|
||||
config.pin_reset = CAMERA_PIN_RESET;
|
||||
config.xclk_freq_hz = XCLK_FREQ_HZ;
|
||||
config.pixel_format = PIXFORMAT_RGB565;
|
||||
config.frame_size = FRAMESIZE_VGA;
|
||||
config.jpeg_quality = 12;
|
||||
config.fb_count = 1;
|
||||
config.fb_location = CAMERA_FB_IN_PSRAM;
|
||||
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
|
||||
|
||||
camera_ = new Esp32Camera(config);
|
||||
camera_->SetVFlip(1);
|
||||
}
|
||||
|
||||
public:
|
||||
DfrobotEsp32S3AiCam() :
|
||||
boot_button_(BOOT_BUTTON_GPIO) {
|
||||
InitializeButtons();
|
||||
InitializeCamera();
|
||||
}
|
||||
|
||||
// Wakenet model only
|
||||
|
||||
virtual Led* GetLed() override {
|
||||
static GpioLed led(BUILTIN_LED_GPIO, 0);
|
||||
return &led;
|
||||
}
|
||||
|
||||
virtual AudioCodec* GetAudioCodec() override {
|
||||
static NoAudioCodecSimplexPdm audio_codec(AUDIO_INPUT_SAMPLE_RATE, AUDIO_OUTPUT_SAMPLE_RATE,
|
||||
AUDIO_I2S_SPK_GPIO_BCLK, AUDIO_I2S_SPK_GPIO_LRCK, AUDIO_I2S_SPK_GPIO_DOUT,
|
||||
AUDIO_I2S_MIC_GPIO_SCK, AUDIO_I2S_MIC_GPIO_DIN);
|
||||
return &audio_codec;
|
||||
}
|
||||
|
||||
virtual Camera* GetCamera() override {
|
||||
return camera_;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_BOARD(DfrobotEsp32S3AiCam);
|
||||
|
||||
Reference in New Issue
Block a user