From 67903bfbfe3d70ac9eb5d2d0c14a14da39945846 Mon Sep 17 00:00:00 2001 From: Alan Braithwaite Date: Fri, 5 Apr 2013 16:46:37 -0700 Subject: [PATCH] API change to remove dual loading default case for dac_load_data_buffer_single Also change dac_data from u32 to u16 --- .../libopencm3/stm32/common/dac_common_all.h | 4 +-- lib/stm32/common/dac_common_all.c | 28 ++++--------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/include/libopencm3/stm32/common/dac_common_all.h b/include/libopencm3/stm32/common/dac_common_all.h index b3f75682..cd5be122 100644 --- a/include/libopencm3/stm32/common/dac_common_all.h +++ b/include/libopencm3/stm32/common/dac_common_all.h @@ -401,8 +401,8 @@ void dac_set_trigger_source(u32 dac_trig_src); void dac_set_waveform_generation(u32 dac_wave_ens); void dac_disable_waveform_generation(data_channel dac_channel); void dac_set_waveform_characteristics(u32 dac_mamp); -void dac_load_data_buffer_single(u32 dac_data, data_align dac_data_format, data_channel dac_channel); -void dac_load_data_buffer_dual(u32 dac_data1, u32 dac_data2, data_align dac_data_format); +void dac_load_data_buffer_single(u16 dac_data, data_align dac_data_format, data_channel dac_channel); +void dac_load_data_buffer_dual(u16 dac_data1, u16 dac_data2, data_align dac_data_format); void dac_software_trigger(data_channel dac_channel); END_DECLS diff --git a/lib/stm32/common/dac_common_all.c b/lib/stm32/common/dac_common_all.c index 3959b4dd..3a6a8ca3 100644 --- a/lib/stm32/common/dac_common_all.c +++ b/lib/stm32/common/dac_common_all.c @@ -402,18 +402,12 @@ data to be converted on a channel. The data can be aligned as follows: @li right-aligned 12 bit data in bits 0-11 @li left aligned 12 bit data in bits 4-15 -This function can also be used to load the dual channel registers if the data is -formatted according to the datasheets: -@li right-aligned 8 bit data in bits 0-7 for channel 1 and 8-15 for channel 2 -@li right-aligned 12 bit data in bits 0-11 for channel 1 and 16-27 for channel 2 -@li left aligned 12 bit data in bits 4-15 for channel 1 and 20-31 for channel 2 - -@param[in] dac_data u32 with appropriate alignment. +@param[in] dac_data u16 with appropriate alignment. @param[in] dac_data_format enum ::data_align. Alignment and size. @param[in] dac_channel enum ::data_channel. */ -void dac_load_data_buffer_single(u32 dac_data, data_align dac_data_format, data_channel dac_channel) +void dac_load_data_buffer_single(u16 dac_data, data_align dac_data_format, data_channel dac_channel) { if (dac_channel == CHANNEL_1) { @@ -443,18 +437,6 @@ void dac_load_data_buffer_single(u32 dac_data, data_align dac_data_format, data_ break; } } - else - switch (dac_data_format) { - case RIGHT8: - DAC_DHR8RD = dac_data; - break; - case RIGHT12: - DAC_DHR12RD = dac_data; - break; - case LEFT12: - DAC_DHR12LD = dac_data; - break; - } } /*-----------------------------------------------------------------------------*/ @@ -465,12 +447,12 @@ Loads the appropriate digital to analog converter dual data register with 12 or simultaneous or independent analog output. The data in both channels are aligned identically. -@param[in] dac_data1 u32 for channel 1 with appropriate alignment. -@param[in] dac_data2 u32 for channel 2 with appropriate alignment. +@param[in] dac_data1 u16 for channel 1 with appropriate alignment. +@param[in] dac_data2 u16 for channel 2 with appropriate alignment. @param[in] dac_data_format enum ::data_align. Right or left aligned, and 8 or 12 bit. */ -void dac_load_data_buffer_dual(u32 dac_data1, u32 dac_data2, data_align dac_data_format) +void dac_load_data_buffer_dual(u16 dac_data1, u16 dac_data2, data_align dac_data_format) { switch (dac_data_format) { case RIGHT8: