Skip to content

Commit 379bda2

Browse files
authored
Merge pull request #13221 from jeromecoutant/PR_DAC_TICKLESS
STM32 ANALOGOUT and DEEPSLEEP
2 parents aeacaa8 + a0b718f commit 379bda2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

targets/TARGET_STM/TARGET_STM32L4/analogout_device.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "pinmap.h"
3535
#include "mbed_error.h"
3636
#include "PeripheralPins.h"
37+
#include "mbed_power_mgmt.h"
3738

3839
// These variables are used for the "free" function
3940
static int channel1_used = 0;
@@ -106,6 +107,9 @@ static void _analogout_init_direct(dac_t *obj, const PinMap *pinmap)
106107
}
107108

108109
analogout_write_u16(obj, 0);
110+
111+
/* DAC cannot be used in deepsleep/STOP mode */
112+
sleep_manager_lock_deep_sleep();
109113
}
110114

111115
void analogout_init(dac_t *obj, PinName pin)
@@ -138,6 +142,8 @@ void analogout_free(dac_t *obj)
138142

139143
// Configure GPIO
140144
pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
145+
146+
sleep_manager_unlock_deep_sleep();
141147
}
142148

143149
const PinMap *analogout_pinmap()

0 commit comments

Comments
 (0)