forked from CarlosDerSeher/snapclient
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with sample stuffing (CarlosDerSeher#69)
* upgrade to IDF v5.1.1 * add new synchronization implementation, use sample stuffing / removal to keep up sync * use big DMA buffer for I2S and improve sync * Add DAC TAS5805M as custom board * add wifi credential reset o press reset button (nRESET pin) 3 times but wait about 1s between button presses the button press counter is reset 5s after boot * Add support for PT8211 DAC (CarlosDerSeher#78) * upgrade ethernet interface to IDF v5 (CarlosDerSeher#84) * port official example of ethernet for IDF v5.x * Fix cmake if guard for ethernet Signed-off-by: Karl Osterseher <[email protected]> Co-authored-by: DerPicknicker <[email protected]> Co-authored-by: whc2001 <[email protected]>
- Loading branch information
1 parent
7e355cd
commit 34af2f8
Showing
20 changed files
with
2,566 additions
and
1,174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Princeton Technology PT8211 audio hal | ||
*/ | ||
|
||
#ifndef _PT8211_H_ | ||
#define _PT8211_H_ | ||
|
||
#include "audio_hal.h" | ||
#include "esp_err.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* Initialize PT8211 codec chip | ||
*/ | ||
esp_err_t pt8211_init(audio_hal_codec_config_t *codec_cfg); | ||
|
||
/** | ||
* Deinitialize PT8211 codec chip | ||
*/ | ||
esp_err_t pt8211_deinit(void); | ||
|
||
/** | ||
* Set volume - NOT AVAILABLE | ||
*/ | ||
esp_err_t pt8211_set_volume(int vol); | ||
|
||
/** | ||
* Get volume - NOT AVAILABLE | ||
*/ | ||
esp_err_t pt8211_get_volume(int *value); | ||
|
||
/** | ||
* Set PT8211 mute or not | ||
*/ | ||
esp_err_t pt8211_set_mute(bool enable); | ||
|
||
/** | ||
* Get PT8211 mute status - NOT IMPLEMENTED | ||
*/ | ||
esp_err_t pt8211_get_mute(bool *enabled); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Princeton Technology PT8211 audio hal | ||
* | ||
* Mostly stubs (no I2C or volume control) | ||
* Configuration of mute/unmute gpio in init (for external amplifier) | ||
*/ | ||
|
||
#include "pt8211.h" | ||
|
||
#include <driver/gpio.h> | ||
|
||
#include "board.h" | ||
#include "esp_log.h" | ||
|
||
#ifndef CONFIG_PT8211_MUTE_ACTIVE_LOW | ||
#define CONFIG_PT8211_MUTE_ACTIVE_LOW 0 | ||
#endif | ||
|
||
static const char *TAG = "PT8211"; | ||
|
||
esp_err_t pt8211_ctrl(audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state); | ||
esp_err_t pt8211_config_iface(audio_hal_codec_mode_t mode, | ||
audio_hal_codec_i2s_iface_t *iface); | ||
|
||
audio_hal_func_t AUDIO_CODEC_PT8211_DEFAULT_HANDLE = { | ||
.audio_codec_initialize = pt8211_init, | ||
.audio_codec_deinitialize = pt8211_deinit, | ||
.audio_codec_ctrl = pt8211_ctrl, | ||
.audio_codec_config_iface = pt8211_config_iface, | ||
.audio_codec_set_mute = pt8211_set_mute, | ||
.audio_codec_set_volume = pt8211_set_volume, | ||
.audio_codec_get_volume = pt8211_get_volume, | ||
.audio_hal_lock = NULL, | ||
.handle = NULL, | ||
}; | ||
|
||
esp_err_t pt8211_init(audio_hal_codec_config_t *codec_cfg) { | ||
esp_err_t ret = ESP_OK; | ||
|
||
#if CONFIG_PT8211_MUTE_PIN != -1 | ||
gpio_config_t io_conf; | ||
|
||
io_conf.intr_type = GPIO_INTR_DISABLE; | ||
io_conf.mode = GPIO_MODE_OUTPUT; | ||
io_conf.pin_bit_mask = (1ULL << CONFIG_PT8211_MUTE_PIN); | ||
io_conf.pull_down_en = 0; | ||
io_conf.pull_up_en = 0; | ||
|
||
ret = gpio_config(&io_conf); | ||
if (ret != ESP_OK) { | ||
ESP_LOGE(TAG, "Mute gpio config failed for pin %d", CONFIG_PT8211_MUTE_PIN); | ||
} else { | ||
gpio_set_level(CONFIG_PT8211_MUTE_PIN, 0); | ||
ESP_LOGD(TAG, "Setup mute output %d\n", CONFIG_PT8211_MUTE_PIN); | ||
} | ||
#else | ||
ESP_LOGD(TAG, "Mute gpio not specified\n"); | ||
#endif | ||
|
||
return ret; | ||
} | ||
|
||
esp_err_t pt8211_set_volume(int vol) { return ESP_OK; } | ||
|
||
esp_err_t pt8211_get_volume(int *value) { return ESP_OK; } | ||
|
||
esp_err_t pt8211_set_mute(bool enable) { | ||
esp_err_t ret = ESP_OK; | ||
|
||
#if CONFIG_PT8211_MUTE_PIN != -1 | ||
ret = gpio_set_level(CONFIG_PT8211_MUTE_PIN, | ||
enable ^ CONFIG_PT8211_MUTE_ACTIVE_LOW); | ||
#endif | ||
|
||
return ret; | ||
} | ||
|
||
esp_err_t pt8211_get_mute(bool *enabled) { return ESP_OK; } | ||
|
||
esp_err_t pt8211_deinit(void) { return gpio_reset_pin(CONFIG_PT8211_MUTE_PIN); } | ||
|
||
esp_err_t pt8211_ctrl(audio_hal_codec_mode_t mode, | ||
audio_hal_ctrl_t ctrl_state) { | ||
return ESP_OK; | ||
} | ||
|
||
esp_err_t pt8211_config_iface(audio_hal_codec_mode_t mode, | ||
audio_hal_codec_i2s_iface_t *iface) { | ||
return ESP_OK; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
|
||
if(CONFIG_SNAPCLIENT_ENABLE_ETHERNET) | ||
|
||
idf_component_register(SRCS "eth_interface.c" | ||
INCLUDE_DIRS "include") | ||
|
||
else() | ||
|
||
idf_component_register() | ||
|
||
endif() | ||
INCLUDE_DIRS "include" | ||
REQUIRES driver esp_eth esp_netif) |
Oops, something went wrong.