esp-adf
esp-adf copied to clipboard
Use custom keys (AUD-3857)
Hi I'm using the ESP32-LyraT-Mini_V1.2
I soldered a wire to the GPIO4 in order to read analog data from a other board that has buttons separated by different resistors values.
It is working with adc2_get_raw(ADC2_CHANNEL_0, ADC_WIDTH_BIT_12, &raw);
But I'd like to use those keys with events like on the example of `get-started/play_mp3_control``
ESP_LOGI(TAG, "[ 3 ] Create and start input key service");
input_key_service_info_t input_key_info[] = INPUT_KEY_DEFAULT_INFO();
input_key_service_cfg_t input_cfg = INPUT_KEY_SERVICE_DEFAULT_CONFIG();
input_cfg.handle = set;
periph_service_handle_t input_ser = input_key_service_create(&input_cfg);
input_key_service_add_key(input_ser, input_key_info, INPUT_KEY_NUM);
periph_service_set_callback(input_ser, input_key_service_cb, (void *)board_handle);
Is it possible ? Where can I find the documentation to achieve this ? Thanks
Hi @teddykishi
Yes, GPIO4 is the optional pin of the four-wire sdcard, and GPIO39 is the input pin of the ADC button of the development board.
Please check here. https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/dev-boards/get-started-esp32-lyrat-mini.html
Thank you for your response, but I would like to know how to add my sensor values from GPIO4 to
static esp_err_t input_key_service_cb(periph_service_handle_t handle, periph_service_event_t *evt, void *ctx)
Thank you verry much
@teddykishi I think you can change the adc_btn_tag.adc_ch
to ADC1_CHANNEL_4
after https://github.com/espressif/esp-adf/blob/b1d505b19afeb8ff89efb351c29b6b7a93e9a7a7/components/audio_board/lyrat_mini_v1_1/board.c#L114
This topic has become inactive so I'm going to close the issue. Please reopen this if you have any questions or need any further assistance.