diff options
Diffstat (limited to 'extmod/modmachine.h')
-rw-r--r-- | extmod/modmachine.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/extmod/modmachine.h b/extmod/modmachine.h index b0235dcf6..e635eedaa 100644 --- a/extmod/modmachine.h +++ b/extmod/modmachine.h @@ -29,7 +29,44 @@ #include "py/obj.h" +// Whether to enable the ADC.init() method. +// Requires a port to implement mp_machine_adc_init_helper(). +#ifndef MICROPY_PY_MACHINE_ADC_INIT +#define MICROPY_PY_MACHINE_ADC_INIT (0) +#endif + +// Whether to enable the ADC.deinit() method. +// Requires a port to implement mp_machine_adc_deinit(). +#ifndef MICROPY_PY_MACHINE_ADC_DEINIT +#define MICROPY_PY_MACHINE_ADC_DEINIT (0) +#endif + +// Whether to enable the ADC.block() method. +// Requires a port to implement mp_machine_adc_block(). +#ifndef MICROPY_PY_MACHINE_ADC_BLOCK +#define MICROPY_PY_MACHINE_ADC_BLOCK (0) +#endif + +// Whether to enable the ADC.read_uv() method. +// Requires a port to implement mp_machine_adc_read_uv(). +#ifndef MICROPY_PY_MACHINE_ADC_READ_UV +#define MICROPY_PY_MACHINE_ADC_READ_UV (0) +#endif + +// Whether to enable the ADC.atten() and ADC.width() methods. +// Note: these are legacy and should not be used on new ports. +#ifndef MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH +#define MICROPY_PY_MACHINE_ADC_ATTEN_WIDTH (0) +#endif + +// Whether to enable the ADC.read() method. +// Note: this is legacy and should not be used on new ports. +#ifndef MICROPY_PY_MACHINE_ADC_READ +#define MICROPY_PY_MACHINE_ADC_READ (0) +#endif + // A port must provide these types, but they are otherwise opaque. +typedef struct _machine_adc_obj_t machine_adc_obj_t; typedef struct _machine_i2s_obj_t machine_i2s_obj_t; typedef struct _machine_pwm_obj_t machine_pwm_obj_t; typedef struct _machine_wdt_obj_t machine_wdt_obj_t; @@ -37,6 +74,7 @@ typedef struct _machine_wdt_obj_t machine_wdt_obj_t; // These classes correspond to machine.Type entries in the machine module. // Their Python bindings are implemented in extmod, and their implementation // is provided by a port. +extern const mp_obj_type_t machine_adc_type; extern const mp_obj_type_t machine_i2c_type; extern const mp_obj_type_t machine_i2s_type; extern const mp_obj_type_t machine_pwm_type; |