split between to device to have bluetooth or usb otg function.
This commit is contained in:
@@ -2,18 +2,23 @@
|
||||
* USB Audio Host - USB Headset Unterstützung
|
||||
*
|
||||
* Verwendet ESP32-S3 USB OTG im Host-Modus für USB Audio Class Geräte
|
||||
* Nur auf ESP32-S3 verfügbar (USB OTG Hardware)
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "usb_audio_host.h"
|
||||
#include "esp_log.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
static const char* TAG = "USB_AUDIO";
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32S3
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/ringbuf.h"
|
||||
#include "usb/usb_host.h"
|
||||
|
||||
static const char* TAG = "USB_AUDIO";
|
||||
|
||||
// USB Audio Class Definitionen
|
||||
#define USB_CLASS_AUDIO 0x01
|
||||
#define USB_SUBCLASS_AUDIOCONTROL 0x01
|
||||
@@ -354,3 +359,77 @@ void usb_audio_host_register_button_callback(usb_button_callback_t callback)
|
||||
{
|
||||
s_button_callback = callback;
|
||||
}
|
||||
|
||||
bool usb_audio_host_is_available(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#else // Nicht ESP32-S3 - Stub-Implementierungen
|
||||
|
||||
esp_err_t usb_audio_host_init(void)
|
||||
{
|
||||
ESP_LOGW(TAG, "USB Audio Host nicht verfügbar (nur ESP32-S3)");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t usb_audio_host_deinit(void)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
usb_audio_state_t usb_audio_host_get_state(void)
|
||||
{
|
||||
return USB_AUDIO_STATE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
bool usb_audio_host_is_connected(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
esp_err_t usb_audio_host_get_info(usb_audio_info_t* info)
|
||||
{
|
||||
(void)info;
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t usb_audio_host_start_stream(void)
|
||||
{
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t usb_audio_host_stop_stream(void)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t usb_audio_host_send(const uint8_t* data, size_t len)
|
||||
{
|
||||
(void)data;
|
||||
(void)len;
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t usb_audio_host_set_volume(uint8_t volume)
|
||||
{
|
||||
(void)volume;
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t usb_audio_host_set_mute(bool mute)
|
||||
{
|
||||
(void)mute;
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
void usb_audio_host_register_state_callback(usb_audio_state_callback_t callback) { (void)callback; }
|
||||
void usb_audio_host_register_data_callback(usb_audio_data_callback_t callback) { (void)callback; }
|
||||
void usb_audio_host_register_button_callback(usb_button_callback_t callback) { (void)callback; }
|
||||
|
||||
bool usb_audio_host_is_available(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // CONFIG_IDF_TARGET_ESP32S3
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -103,6 +104,11 @@ void usb_audio_host_register_state_callback(usb_audio_state_callback_t callback)
|
||||
void usb_audio_host_register_data_callback(usb_audio_data_callback_t callback);
|
||||
void usb_audio_host_register_button_callback(usb_button_callback_t callback);
|
||||
|
||||
/**
|
||||
* Prüft ob USB Audio Host verfügbar ist (Hardware-Support)
|
||||
*/
|
||||
bool usb_audio_host_is_available(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user