Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
Diff: targets/TARGET_STM/TARGET_STM32L0/analogout_device.c
- Revision:
- 176:447f873cad2f
- Parent:
- 168:9672193075cf
- Child:
- 187:0387e8f68319
--- a/targets/TARGET_STM/TARGET_STM32L0/analogout_device.c Wed Oct 11 12:45:49 2017 +0100 +++ b/targets/TARGET_STM/TARGET_STM32L0/analogout_device.c Wed Oct 25 14:53:38 2017 +0100 @@ -40,7 +40,7 @@ static int channel2_used = 0; void analogout_init(dac_t *obj, PinName pin) { - DAC_ChannelConfTypeDef sConfig; + DAC_ChannelConfTypeDef sConfig = {0}; // Get the peripheral name from the pin and assign it to the object obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC); @@ -74,6 +74,8 @@ // Configure DAC obj->handle.Instance = DAC; + obj->handle.State = HAL_DAC_STATE_RESET; + if (HAL_DAC_Init(&obj->handle) != HAL_OK ) { error("HAL_DAC_Init failed"); }