mirror of https://github.com/ARMmbed/mbed-os.git
Coding style and add State field init
parent
c5cc9ec8cf
commit
868143e3dd
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue