Ejemplo n.º 1
0
void analogout_free(dac_t *obj) {
    // Reset DAC and disable clock
    __DAC1_FORCE_RESET();
    __DAC1_RELEASE_RESET();
    __DAC1_CLK_DISABLE();

    // Configure GPIO
    pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
}
Ejemplo n.º 2
0
void analogout_free(dac_t *obj)
{
    // Reset DAC and disable clock
    if (obj->pin == PA_4) pa4_used = 0;
    if (obj->pin == PA_5) pa5_used = 0;

    if ((pa4_used == 0) && (pa5_used == 0)) {
        __DAC1_FORCE_RESET();
        __DAC1_RELEASE_RESET();
        __DAC1_CLK_DISABLE();
    }

#if defined(DAC2)
    if (obj->pin == PA_6) {
        __DAC2_FORCE_RESET();
        __DAC2_RELEASE_RESET();
        __DAC2_CLK_DISABLE();
    }
#endif

    // Configure GPIO
    pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
}