STM32 ANALOGOUT and DEEPSLEEP

keep DAC on during wait period
pull/13221/head
jeromecoutant 2020-07-02 14:18:44 +02:00
parent ffeb926a67
commit a0b718fc04
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#include "pinmap.h"
#include "mbed_error.h"
#include "PeripheralPins.h"
#include "mbed_power_mgmt.h"
// These variables are used for the "free" function
static int channel1_used = 0;
@ -106,6 +107,9 @@ static void _analogout_init_direct(dac_t *obj, const PinMap *pinmap)
}
analogout_write_u16(obj, 0);
/* DAC cannot be used in deepsleep/STOP mode */
sleep_manager_lock_deep_sleep();
}
void analogout_init(dac_t *obj, PinName pin)
@ -138,6 +142,8 @@ void analogout_free(dac_t *obj)
// Configure GPIO
pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
sleep_manager_unlock_deep_sleep();
}
const PinMap *analogout_pinmap()