added pin object to analogout
This commit is contained in:
parent
9fdecacec7
commit
35030fbb30
@ -75,6 +75,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
self->channel = channel;
|
self->channel = channel;
|
||||||
|
self->pin = pin;
|
||||||
|
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
hri_mclk_set_APBDMASK_DAC_bit(MCLK);
|
hri_mclk_set_APBDMASK_DAC_bit(MCLK);
|
||||||
@ -129,7 +130,9 @@ void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dac_sync_disable_channel(&self->descriptor, self->channel);
|
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.
|
// Only deinit the DAC on the SAMD51 if both outputs are free.
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
if (common_hal_mcu_pin_is_free(&pin_PA02) && common_hal_mcu_pin_is_free(&pin_PA05)) {
|
if (common_hal_mcu_pin_is_free(&pin_PA02) && common_hal_mcu_pin_is_free(&pin_PA05)) {
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
|
const mcu_pin_obj_t *pin;
|
||||||
struct dac_sync_descriptor descriptor;
|
struct dac_sync_descriptor descriptor;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
bool deinited;
|
bool deinited;
|
||||||
|
Loading…
Reference in New Issue
Block a user