forked from micropython/micropython
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esp32/machine_adcblock: Add new machine.ADCBlock class and update ADC.
Rework the ADC implementation to follow the improved ADC/ADCBlock API. This adds support for calibrated voltage readings and the ADC2 block. The ADC API is backwards compatible with what it was before this change. Resolves micropython#6219.
- Loading branch information
1 parent
c0a450d
commit 022b4ee
Showing
8 changed files
with
410 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef MICROPY_INCLUDED_MACHINE_ADC_H | ||
#define MICROPY_INCLUDED_MACHINE_ADC_H | ||
|
||
#include "machine_adcblock.h" | ||
|
||
typedef struct _madc_obj_t { | ||
mp_obj_base_t base; | ||
madcblock_obj_t *block; | ||
adc_channel_t channel_id; | ||
gpio_num_t gpio_id; | ||
} madc_obj_t; | ||
|
||
extern const madc_obj_t *madc_search_helper(madcblock_obj_t *block, adc_channel_t channel_id, gpio_num_t gpio_id); | ||
extern void madc_init_helper(const madc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args); | ||
|
||
#endif // MICROPY_INCLUDED_MACHINE_ADC_H |
Oops, something went wrong.