added pin object to analogout

This commit is contained in:
BoB LeSuer 2021-07-12 20:33:42 -04:00
parent 9fdecacec7
commit 35030fbb30
2 changed files with 5 additions and 1 deletions

View File

@ -75,6 +75,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self,
}
self->channel = channel;
self->pin = pin;
#ifdef SAM_D5X_E5X
hri_mclk_set_APBDMASK_DAC_bit(MCLK);
@ -129,7 +130,9 @@ void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
return;
}
dac_sync_disable_channel(&self->descriptor, self->channel);
reset_pin_number(PIN_PA02);
reset_pin_number(self->pin->number);
self->pin = NULL;
// Only deinit the DAC on the SAMD51 if both outputs are free.
#ifdef SAM_D5X_E5X
if (common_hal_mcu_pin_is_free(&pin_PA02) && common_hal_mcu_pin_is_free(&pin_PA05)) {

View File

@ -35,6 +35,7 @@
typedef struct {
mp_obj_base_t base;
const mcu_pin_obj_t *pin;
struct dac_sync_descriptor descriptor;
uint8_t channel;
bool deinited;