summaryrefslogtreecommitdiff
path: root/ports/samd/modmachine.c
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-06-05 10:34:23 +0200
committerDamien George <damien@micropython.org>2022-10-06 22:41:44 +1100
commit5c7e93ec48b04a6a049cc7f2ec90230cd64ecba2 (patch)
tree9c93ccdd212ac239041a56f103f52f8820a8eceb /ports/samd/modmachine.c
parent6765d4bbd66c19898158504ed8102ebd8de4c645 (diff)
samd/machine_adc: Add the machine.ADC class.
With the method read_u16(). Keyword arguments of the constructor are: - bits=n The resolution; default is 12. - average=n The average of samples, which are taken and cumulated. The default value is 16. Averaging by hw is faster than averaging in code. The ADC runs at a clock freq 1.5 MHz. A single 12 bit conversion takes 8 microseconds.
Diffstat (limited to 'ports/samd/modmachine.c')
-rw-r--r--ports/samd/modmachine.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ports/samd/modmachine.c b/ports/samd/modmachine.c
index b095a6b39..287641cc3 100644
--- a/ports/samd/modmachine.c
+++ b/ports/samd/modmachine.c
@@ -129,8 +129,10 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_mem16), MP_ROM_PTR(&machine_mem16_obj) },
{ MP_ROM_QSTR(MP_QSTR_mem32), MP_ROM_PTR(&machine_mem32_obj) },
{ MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) },
- { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) },
+
+ { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&machine_adc_type) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&machine_led_type) },
+ { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) },
{ MP_ROM_QSTR(MP_QSTR_SoftI2C), MP_ROM_PTR(&mp_machine_soft_i2c_type) },
{ MP_ROM_QSTR(MP_QSTR_SoftSPI), MP_ROM_PTR(&mp_machine_soft_spi_type) },
};