From 856303d8f1e57511ec7c479e5285b37617a310df Mon Sep 17 00:00:00 2001 From: philippe44 Date: Tue, 29 Nov 2022 13:58:09 -0800 Subject: [PATCH] Add GPIO config for Infrared on SqueezeAMP 3.20 --- build-scripts/SqueezeAmp-sdkconfig.defaults | 2 +- components/services/buttons.c | 4 +++- main/Kconfig.projbuild | 14 +++++++++----- sdkconfig.defaults | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build-scripts/SqueezeAmp-sdkconfig.defaults b/build-scripts/SqueezeAmp-sdkconfig.defaults index 84f44419..9715455f 100644 --- a/build-scripts/SqueezeAmp-sdkconfig.defaults +++ b/build-scripts/SqueezeAmp-sdkconfig.defaults @@ -259,7 +259,7 @@ CONFIG_CSPOT_SINK=y # Various I/O # CONFIG_I2C_CONFIG="" -CONFIG_SET_GPIO="" +CONFIG_SET_GPIO="0=ir" CONFIG_ROTARY_ENCODER="" # end of Various I/O diff --git a/components/services/buttons.c b/components/services/buttons.c index 6d240a66..94c54207 100644 --- a/components/services/buttons.c +++ b/components/services/buttons.c @@ -415,7 +415,7 @@ bool create_rotary(void *id, int A, int B, int SW, int long_press, rotary_handle // create companion button if rotary has a switch if (SW != -1) button_create(id, SW, BUTTON_LOW, true, 0, rotary_button_handler, long_press, -1); - ESP_LOGI(TAG, "Creating rotary encoder A:%d B:%d, SW:%d", A, B, SW); + ESP_LOGI(TAG, "Created rotary encoder A:%d B:%d, SW:%d", A, B, SW); return true; } @@ -432,5 +432,7 @@ bool create_infrared(int gpio, infrared_handler handler) { common_task_init(); xRingbufferAddToQueueSetRead(infrared.rb, common_queue_set); + ESP_LOGI(TAG, "Created infrared receiver using GPIO %u", gpio); + return (infrared.rb != NULL); } diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 22a4bed6..4c7c1ef4 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -117,7 +117,7 @@ menu "Squeezelite-ESP32" string default "dc=27,data=19,clk=18" if TWATCH2020 default "mosi=15,miso=2,clk=14" if MUSE - default "" + default "" config DISPLAY_CONFIG string default "SPI,driver=ST7789,width=240,height=240,cs=5,back=12,speed=16000000,HFlip,VFlip" if TWATCH2020 @@ -125,7 +125,7 @@ menu "Squeezelite-ESP32" config ETH_CONFIG string default "" - # AGGREGATES - end + # AGGREGATES - end config DAC_CONTROLSET string default "{ \"init\": [ {\"reg\":41, \"val\":128}, {\"reg\":18, \"val\":255} ], \"poweron\": [ {\"reg\":18, \"val\":64, \"mode\":\"or\"} ], \"poweroff\": [ {\"reg\":18, \"val\":191, \"mode\":\"and\"} ] }" if TWATCH2020 @@ -168,6 +168,9 @@ menu "Squeezelite-ESP32" int default 13 if SQUEEZEAMP default -1 + config SET_GPIO + string + default "0=ir" if SQUEEZEAMP endmenu menu "Audio settings" @@ -342,14 +345,15 @@ menu "Squeezelite-ESP32" data=,clk=[,d/c=][,host=<0|1|2>] config SET_GPIO string "Special GPIO configuration" - default "" help Set parameters of shared GPIO with special values. - =Vcc|GND|amp[:0|1]|jack[:0|1][,=Vcc|GND|amp[:0|1]|jack[:0|1]] + =Vcc|GND|amp[:0|1]|jack[:0|1][ir][spkfault[:0|1][,=Vcc|GND|amp[:0|1]|jack[:0|1]] 'amp' => GPIO that is set when playback starts 'jack' => GPIO used for audio jack detection 'green', 'red' => GPIO for status LED - '[:0|1] means set the active value for that GPIO can be low or high + 'spkfault' => GPIO used for speaker fault detection + 'ir' => GPIO used for Infrared Receiver + [:0|1] means set the active value for that GPIO can be low or high config ROTARY_ENCODER string "Rotary Encoder configuration" default "" diff --git a/sdkconfig.defaults b/sdkconfig.defaults index 503124c1..afe2af8b 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -262,7 +262,7 @@ CONFIG_AIRPLAY_PORT="5000" # Various I/O # CONFIG_I2C_CONFIG="" -CONFIG_SET_GPIO="" +# CONFIG_SET_GPIO= is not set CONFIG_ROTARY_ENCODER="" # end of Various I/O