mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogout_api.c
- Revision:
- 217:d0ccc61c1fd4
- Parent:
- 201:fa203361dc70
- Child:
- 227:7bd0639b8911
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogout_api.c Tue May 27 10:00:08 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/analogout_api.c Tue May 27 13:00:07 2014 +0100 @@ -58,7 +58,7 @@ pinmap_pinout(pin, PinMap_DAC); // Save the channel for future use - obj->channel = pin; + obj->pin = pin; // Enable DAC clock __DAC_CLK_ENABLE(); @@ -67,9 +67,7 @@ sConfig.DAC_Trigger = DAC_TRIGGER_NONE; sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_DISABLE; - //if (pin == PA_4) { HAL_DAC_ConfigChannel(&DacHandle, &sConfig, DAC_CHANNEL_1); - //} analogout_write_u16(obj, 0); } @@ -81,20 +79,16 @@ __DAC_CLK_DISABLE(); // Configure GPIO - pin_function(obj->channel, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)); + pin_function(obj->pin, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)); } static inline void dac_write(dac_t *obj, uint16_t value) { - //if (obj->channel == PA_4) { HAL_DAC_SetValue(&DacHandle, DAC_CHANNEL_1, DAC_ALIGN_12B_R, value); HAL_DAC_Start(&DacHandle, DAC_CHANNEL_1); - //} } static inline int dac_read(dac_t *obj) { - //if (obj->channel == PA_4) { return (int)HAL_DAC_GetValue(&DacHandle, DAC_CHANNEL_1); - //} } void analogout_write(dac_t *obj, float value) {