I'm fairly new to the ESP32 environment and i would like to know if there is a way through menuconfig an option to enable A2DP to take data from ADC channel
Right now what i'm doing is modifying the a2dp_source example. Especifically the data_cb function like so:
Code: Select all
static int32_t bt_app_a2d_data_cb(uint8_t *data, int32_t len)
{
if (len < 0 || data == NULL) {
return 0;
}
// generate random sequence
for (int i = 0; i < (len >> 1); i++) {
int val = adc1_get_raw(ADC1_CHANNEL_0);
// val = ((val << 4) & (uint16_t)0xFFF0) | ((val>> 8) & (uint16_t)0x000F);
data[(i << 1)] = val & 0xff;
data[(i << 1) + 1] = (val >> 8) & 0xff;
}
vTaskDelay( pdMS_TO_TICKS( 1 ) );
return len;
}
Is there a better way to do this?
Thank you!!