mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5263 from bcostm/fix_init_struct
STM32: Fix analogout structure/variable wrong initializationpull/4955/head
commit
6a74cdb39c
|
@ -36,7 +36,7 @@
|
||||||
#include "PeripheralPins.h"
|
#include "PeripheralPins.h"
|
||||||
|
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
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
|
// Get the peripheral name from the pin and assign it to the object
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
|
@ -71,6 +71,8 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
|
|
||||||
// Configure DAC
|
// Configure DAC
|
||||||
obj->handle.Instance = (DAC_TypeDef *)(obj->dac);
|
obj->handle.Instance = (DAC_TypeDef *)(obj->dac);
|
||||||
|
obj->handle.State = HAL_DAC_STATE_RESET;
|
||||||
|
|
||||||
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
||||||
error("HAL_DAC_Init failed");
|
error("HAL_DAC_Init failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ static int pa4_used = 0;
|
||||||
static int pa5_used = 0;
|
static int pa5_used = 0;
|
||||||
|
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
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
|
// Get the peripheral name from the pin and assign it to the object
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
|
@ -83,6 +83,8 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
|
|
||||||
// Configure DAC
|
// Configure DAC
|
||||||
obj->handle.Instance = (DAC_TypeDef *)(obj->dac);
|
obj->handle.Instance = (DAC_TypeDef *)(obj->dac);
|
||||||
|
obj->handle.State = HAL_DAC_STATE_RESET;
|
||||||
|
|
||||||
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
||||||
error("HAL_DAC_Init failed");
|
error("HAL_DAC_Init failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "PeripheralPins.h"
|
#include "PeripheralPins.h"
|
||||||
|
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
void analogout_init(dac_t *obj, PinName pin) {
|
||||||
DAC_ChannelConfTypeDef sConfig;
|
DAC_ChannelConfTypeDef sConfig = {0};
|
||||||
|
|
||||||
// Get the peripheral name (DAC_1, ...) from the pin and assign it to the object
|
// Get the peripheral name (DAC_1, ...) from the pin and assign it to the object
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
|
@ -71,6 +71,8 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
__HAL_RCC_DAC_CLK_ENABLE();
|
__HAL_RCC_DAC_CLK_ENABLE();
|
||||||
|
|
||||||
obj->handle.Instance = DAC;
|
obj->handle.Instance = DAC;
|
||||||
|
obj->handle.State = HAL_DAC_STATE_RESET;
|
||||||
|
|
||||||
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
||||||
error("HAL_DAC_Init failed");
|
error("HAL_DAC_Init failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "PeripheralPins.h"
|
#include "PeripheralPins.h"
|
||||||
|
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
void analogout_init(dac_t *obj, PinName pin) {
|
||||||
DAC_ChannelConfTypeDef sConfig;
|
DAC_ChannelConfTypeDef sConfig = {0};
|
||||||
|
|
||||||
// Get the peripheral name (DAC_1, ...) from the pin and assign it to the object
|
// Get the peripheral name (DAC_1, ...) from the pin and assign it to the object
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
|
@ -71,6 +71,8 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
__DAC_CLK_ENABLE();
|
__DAC_CLK_ENABLE();
|
||||||
|
|
||||||
obj->handle.Instance = DAC;
|
obj->handle.Instance = DAC;
|
||||||
|
obj->handle.State = HAL_DAC_STATE_RESET;
|
||||||
|
|
||||||
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
||||||
error("HAL_DAC_Init failed");
|
error("HAL_DAC_Init failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ static int channel1_used = 0;
|
||||||
static int channel2_used = 0;
|
static int channel2_used = 0;
|
||||||
|
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
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
|
// Get the peripheral name from the pin and assign it to the object
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
|
@ -74,6 +74,8 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
|
|
||||||
// Configure DAC
|
// Configure DAC
|
||||||
obj->handle.Instance = DAC;
|
obj->handle.Instance = DAC;
|
||||||
|
obj->handle.State = HAL_DAC_STATE_RESET;
|
||||||
|
|
||||||
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
||||||
error("HAL_DAC_Init failed");
|
error("HAL_DAC_Init failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ static int pa4_used = 0;
|
||||||
static int pa5_used = 0;
|
static int pa5_used = 0;
|
||||||
|
|
||||||
void analogout_init(dac_t *obj, PinName pin) {
|
void analogout_init(dac_t *obj, PinName pin) {
|
||||||
DAC_ChannelConfTypeDef sConfig;
|
DAC_ChannelConfTypeDef sConfig = {0};
|
||||||
|
|
||||||
// Get the peripheral name (DAC_1, ...) from the pin and assign it to the object
|
// Get the peripheral name (DAC_1, ...) from the pin and assign it to the object
|
||||||
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC);
|
||||||
|
@ -68,6 +68,8 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
obj->pin = pin;
|
obj->pin = pin;
|
||||||
|
|
||||||
obj->handle.Instance = DAC;
|
obj->handle.Instance = DAC;
|
||||||
|
obj->handle.State = HAL_DAC_STATE_RESET;
|
||||||
|
|
||||||
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
||||||
error("HAL_DAC_Init failed");
|
error("HAL_DAC_Init failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,8 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
|
|
||||||
// Configure DAC
|
// Configure DAC
|
||||||
obj->handle.Instance = DAC;
|
obj->handle.Instance = DAC;
|
||||||
|
obj->handle.State = HAL_DAC_STATE_RESET;
|
||||||
|
|
||||||
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
|
||||||
error("HAL_DAC_Init failed");
|
error("HAL_DAC_Init failed");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue