Skip to content

Commit 99b38ea

Browse files
committed
Update ADC comments wrt new chips
1 parent 505c9e5 commit 99b38ea

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/gpio.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ mrb_esp32_gpio_analog_read(mrb_state *mrb, mrb_value self) {
8484
};
8585
ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config1, &adc1_handle));
8686

87-
// Configuration. ADC_BITWIDTH_DEFAULT = 12
87+
// Always use maximum resolution and attenuation.
88+
// Should make this configurable.
8889
adc_oneshot_chan_cfg_t config = {
8990
.bitwidth = ADC_BITWIDTH_DEFAULT,
9091
.atten = ADC_ATTEN_DB_11,
@@ -262,6 +263,7 @@ mrb_mruby_esp32_gpio_gem_init(mrb_state* mrb) {
262263
define_const(GPIO_NUM_48);
263264
#endif
264265

266+
// All chips define ADC_CHANNEL_0..ADC_CHANNEL_9
265267
define_const(ADC_CHANNEL_0);
266268
define_const(ADC_CHANNEL_1);
267269
define_const(ADC_CHANNEL_2);
@@ -270,7 +272,7 @@ mrb_mruby_esp32_gpio_gem_init(mrb_state* mrb) {
270272
define_const(ADC_CHANNEL_5);
271273
define_const(ADC_CHANNEL_6);
272274
define_const(ADC_CHANNEL_7);
273-
// Channel 8 and 9 only exist on ADC2.
275+
// Channel 8 and 9 only on ADC2 for original ESP32, may work on ADC1 for others. Not sure.
274276
define_const(ADC_CHANNEL_8);
275277
define_const(ADC_CHANNEL_9);
276278

0 commit comments

Comments
 (0)