text fixes

This commit is contained in:
Hierophect 2019-09-10 19:51:26 -04:00
parent 500b21c236
commit 99c3cab00f
1 changed files with 2 additions and 90 deletions

View File

@ -36,62 +36,7 @@
void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self,
const mcu_pin_obj_t *pin) {
// #if defined(SAMD21) && !defined(PIN_PA02)
// mp_raise_NotImplementedError(translate("No DAC on chip"));
// #else
// if (pin->number != PIN_PA02
// #ifdef SAMD51
// && pin->number != PIN_PA05
// #endif
// ) {
// mp_raise_ValueError(translate("AnalogOut not supported on given pin"));
// return;
// }
// self->channel = 0;
// #ifdef SAMD51
// if (pin->number == PIN_PA05) {
// self->channel = 1;
// }
// #endif
// #ifdef SAMD51
// hri_mclk_set_APBDMASK_DAC_bit(MCLK);
// #endif
// #ifdef SAMD21
// _pm_enable_bus_clock(PM_BUS_APBC, DAC);
// #endif
// // SAMD21: This clock should be <= 12 MHz, per datasheet section 47.6.3.
// // SAMD51: This clock should be <= 350kHz, per datasheet table 37-6.
// _gclk_enable_channel(DAC_GCLK_ID, CONF_GCLK_DAC_SRC);
// // Don't double init the DAC on the SAMD51 when both outputs are in use. We use the free state
// // of each output pin to determine DAC state.
// int32_t result = ERR_NONE;
// #ifdef SAMD51
// if (!common_hal_mcu_pin_is_free(&pin_PA02) || !common_hal_mcu_pin_is_free(&pin_PA05)) {
// #endif
// // Fake the descriptor if the DAC is already initialized.
// self->descriptor.device.hw = DAC;
// #ifdef SAMD51
// } else {
// #endif
// result = dac_sync_init(&self->descriptor, DAC);
// #ifdef SAMD51
// }
// #endif
// if (result != ERR_NONE) {
// mp_raise_OSError(MP_EIO);
// return;
// }
// claim_pin(pin);
// gpio_set_pin_function(pin->number, GPIO_PIN_FUNCTION_B);
// dac_sync_enable_channel(&self->descriptor, self->channel);
// #endif
mp_raise_ValueError(translate("DAC not supported"));
}
bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
@ -99,47 +44,14 @@ bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
}
void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
// #if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
// if (common_hal_analogio_analogout_deinited(self)) {
// return;
// }
// dac_sync_disable_channel(&self->descriptor, self->channel);
// reset_pin_number(PIN_PA02);
// // Only deinit the DAC on the SAMD51 if both outputs are free.
// #ifdef SAMD51
// if (common_hal_mcu_pin_is_free(&pin_PA02) && common_hal_mcu_pin_is_free(&pin_PA05)) {
// #endif
// dac_sync_deinit(&self->descriptor);
// #ifdef SAMD51
// }
// #endif
// self->deinited = true;
// // TODO(tannewt): Turn off the DAC clocks to save power.
// #endif
}
void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self,
uint16_t value) {
// #if defined(SAMD21) && !defined(PIN_PA02)
// return;
// #endif
// // Input is 16 bit so make sure and set LEFTADJ to 1 so it takes the top
// // bits. This is currently done in asf4_conf/*/hpl_dac_config.h.
// dac_sync_write(&self->descriptor, self->channel, &value, 1);
}
void analogout_reset(void) {
// audioout_reset also resets the DAC, and does a smooth ramp down to avoid clicks
// if it was enabled, so do that instead if AudioOut is enabled.
// #if CIRCUITPY_AUDIOIO
// audioout_reset();
// #else
// #ifdef SAMD21
// while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {}
// #endif
// #ifdef SAMD51
// while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) {}
// #endif
// DAC->CTRLA.reg |= DAC_CTRLA_SWRST;
// #endif
}