Coding style and add State field init

pull/5188/head
bcostm 2017-10-05 10:04:19 +02:00
parent c5cc9ec8cf
commit 868143e3dd
1 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,8 @@
#include "mbed_error.h"
#include "PeripheralPins.h"
void analogout_init(dac_t *obj, PinName pin) {
void analogout_init(dac_t *obj, PinName pin)
{
DAC_ChannelConfTypeDef sConfig = {0};
// Get the peripheral name from the pin and assign it to the object
@ -71,6 +72,8 @@ void analogout_init(dac_t *obj, PinName pin) {
// Configure DAC
obj->handle.Instance = (DAC_TypeDef *)(obj->dac);
obj->handle.State = HAL_DAC_STATE_RESET;
if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {
error("HAL_DAC_Init failed");
}