Skip to content

Commit

Permalink
rename GET_UNIT
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Nov 13, 2023
1 parent 34dcc4d commit e1da6ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/AudioAnalog/AnalogAudioESP32V1.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
adc_digi_pattern_config_t adc_pattern[cfg.channels] = {0};
dig_cfg.pattern_num = cfg.channels;
for (int i = 0; i < cfg.channels; i++) {
uint8_t unit = GET_UNIT(cfg.adc_channels[i]);
uint8_t unit = GET_ADC_UNIT_FROM_CHANNEL(cfg.adc_channels[i]);
uint8_t ch = cfg.adc_channels[i] & 0x7;
adc_pattern[i].atten = cfg.adc_attenuation;
adc_pattern[i].channel = ch;
Expand Down Expand Up @@ -423,9 +423,9 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
// Therefore we prefere ADC1.

// Lets make sure ADC Channels chosen are on same unit:
uint8_t unit = GET_UNIT(cfg.adc_channels[0]);
uint8_t unit = GET_ADC_UNIT_FROM_CHANNEL(cfg.adc_channels[0]);
for (int i = 1; i < cfg.channels; i++) {
if (unit != GET_UNIT(cfg.adc_channels[i])) {
if (unit != GET_ADC_UNIT_FROM_CHANNEL(cfg.adc_channels[i])) {
LOGE("error, dont select ADC channels on different ADC units");
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/AudioAnalog/AnalogConfigESP32V1.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# define ADC_CHANNELS {ADC_CHANNEL_2, ADC_CHANNEL_3} // These are the I2C SDA and SCL pins on Adafruit ESP32-S3 feather , Channel 4&5 might be better
#endif

#define GET_UNIT(x) ((x >> 3) & 0x1)
#define GET_ADC_UNIT_FROM_CHANNEL(x) ((x >> 3) & 0x1)


#ifdef HAS_ESP32_DAC
Expand Down

0 comments on commit e1da6ab

Please sign in to comment.