summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/dac.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-08-06 22:33:31 +0100
committerDamien George <damien.p.george@gmail.com>2014-08-06 22:33:31 +0100
commit3ef911345c94a6d612ab50c1e912e81cb2cc3f71 (patch)
tree9425ff491cd738a3f6ae11028e1834925ea746e2 /stmhal/dac.c
parent8a11d693cf794c8cc276a5715df11ecdc8824ef1 (diff)
downloadmicropython-3ef911345c94a6d612ab50c1e912e81cb2cc3f71.tar.gz
micropython-3ef911345c94a6d612ab50c1e912e81cb2cc3f71.zip
stmhal: Update STM32Cube F4 HAL driver to V1.3.0.
This patch updates ST's HAL to the latest version, V1.3.0, dated 19 June 2014. Files were copied verbatim from the ST package. Only change was to suppress compiler warning of unused variables in 4 places. A lot of the changes from ST are cosmetic: comments and white space. Some small code changes here and there, and addition of F411 header. Main code change is how SysTick interrupt is set: it now has a configuration variable to set the priority, so we no longer need to work around this (originall in system_stm32f4xx.c).
Diffstat (limited to 'stmhal/dac.c')
-rw-r--r--stmhal/dac.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/stmhal/dac.c b/stmhal/dac.c
index acfcf4e91a..45e709c01d 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -24,6 +24,7 @@
* THE SOFTWARE.
*/
+#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -73,6 +74,7 @@
STATIC DAC_HandleTypeDef DAC_Handle;
void dac_init(void) {
+ memset(&DAC_Handle, 0, sizeof DAC_Handle);
DAC_Handle.Instance = DAC;
DAC_Handle.State = HAL_DAC_STATE_RESET;
HAL_DAC_Init(&DAC_Handle);
@@ -142,7 +144,10 @@ STATIC mp_obj_t pyb_dac_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
// stop anything already going on
HAL_DAC_Stop(&DAC_Handle, dac->dac_channel);
- HAL_DAC_Stop_DMA(&DAC_Handle, dac->dac_channel);
+ if ((dac->dac_channel == DAC_CHANNEL_1 && DAC_Handle.DMA_Handle1 != NULL)
+ || (dac->dac_channel == DAC_CHANNEL_2 && DAC_Handle.DMA_Handle2 != NULL)) {
+ HAL_DAC_Stop_DMA(&DAC_Handle, dac->dac_channel);
+ }
dac->state = 0;