mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
merge misc GPIO options into set_GPIO
This commit is contained in:
@@ -52,6 +52,7 @@ sure that using rate_delay would fix that
|
||||
#include "led.h"
|
||||
#include "monitor.h"
|
||||
#include "config.h"
|
||||
#include "accessors.h"
|
||||
|
||||
#define LOCK mutex_lock(outputbuf->mutex)
|
||||
#define UNLOCK mutex_unlock(outputbuf->mutex)
|
||||
@@ -151,6 +152,21 @@ static void jack_handler(bool inserted) {
|
||||
if (jack_handler_chain) (jack_handler_chain)(inserted);
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
* amp GPIO
|
||||
*/
|
||||
void set_amp_gpio(int gpio, char *value) {
|
||||
if (!strcasecmp(value, "amp")) {
|
||||
amp_gpio = gpio;
|
||||
|
||||
gpio_pad_select_gpio(amp_gpio);
|
||||
gpio_set_direction(amp_gpio, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(amp_gpio, 0);
|
||||
|
||||
LOG_INFO("setting amplifier GPIO %d", amp_gpio);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
* Initialize the DAC output
|
||||
*/
|
||||
@@ -258,16 +274,8 @@ void output_init_i2s(log_level level, char *device, unsigned output_buf_size, ch
|
||||
if (jack_mutes_amp && jack_inserted_svc()) adac->speaker(false);
|
||||
else adac->speaker(true);
|
||||
|
||||
p = config_alloc_get_default(NVS_TYPE_STR, "amp_GPIO", NULL, 0);
|
||||
if (p && *p) {
|
||||
amp_gpio = atoi(p);
|
||||
gpio_pad_select_gpio(amp_gpio);
|
||||
gpio_set_direction(amp_gpio, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(amp_gpio, 0);
|
||||
LOG_INFO("setting amplifier GPIO %d", amp_gpio);
|
||||
}
|
||||
free(p);
|
||||
|
||||
parse_set_GPIO(set_amp_gpio);
|
||||
|
||||
esp_pthread_cfg_t cfg = esp_pthread_get_default_config();
|
||||
|
||||
cfg.thread_name= "output_i2s";
|
||||
|
||||
Reference in New Issue
Block a user