stm32: Add board config option to enable/disable the ADC.
The new option is MICROPY_HW_ENABLE_ADC and is enabled by default.
This commit is contained in:
parent
a36c700d9b
commit
60b0982bb2
@ -35,6 +35,8 @@
|
||||
#include "genhdr/pins.h"
|
||||
#include "timer.h"
|
||||
|
||||
#if MICROPY_HW_ENABLE_ADC
|
||||
|
||||
/// \moduleref pyb
|
||||
/// \class ADC - analog to digital conversion: read analog values on a pin
|
||||
///
|
||||
@ -683,3 +685,5 @@ const mp_obj_type_t pyb_adc_all_type = {
|
||||
.make_new = adc_all_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&adc_all_locals_dict,
|
||||
};
|
||||
|
||||
#endif // MICROPY_HW_ENABLE_ADC
|
||||
|
@ -218,8 +218,10 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_CAN), MP_ROM_PTR(&pyb_can_type) },
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_ADC
|
||||
{ MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ADCAll), MP_ROM_PTR(&pyb_adc_all_type) },
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_DAC
|
||||
{ MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&pyb_dac_type) },
|
||||
|
@ -40,6 +40,11 @@
|
||||
#define MICROPY_HW_ENABLE_RNG (0)
|
||||
#endif
|
||||
|
||||
// Whether to enable the ADC peripheral, exposed as pyb.ADC and pyb.ADCAll
|
||||
#ifndef MICROPY_HW_ENABLE_ADC
|
||||
#define MICROPY_HW_ENABLE_ADC (1)
|
||||
#endif
|
||||
|
||||
// Whether to enable the DAC peripheral, exposed as pyb.DAC
|
||||
#ifndef MICROPY_HW_ENABLE_DAC
|
||||
#define MICROPY_HW_ENABLE_DAC (0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user