From a43ef9d17e2a856629f5884c452d56828839744f Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Thu, 2 Jan 2020 12:01:23 +0100 Subject: [PATCH] HardwareTimer: no need to use setMode() when only update interrupt needed Require: Start timer when only update interrupt needed https://github.com/stm32duino/Arduino_Core_STM32/pull/849 Simplify usage timebase interrupt usage: see #841 --- .../HardwareTimer_OutputInput_test.ino | 1 - .../HardwareTimer/Timebase_callback/Timebase_callback.ino | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/NonReg/HardwareTimer/HardwareTimer_OutputInput_test/HardwareTimer_OutputInput_test.ino b/examples/NonReg/HardwareTimer/HardwareTimer_OutputInput_test/HardwareTimer_OutputInput_test.ino index 3ee3d0d..07715a1 100644 --- a/examples/NonReg/HardwareTimer/HardwareTimer_OutputInput_test/HardwareTimer_OutputInput_test.ino +++ b/examples/NonReg/HardwareTimer/HardwareTimer_OutputInput_test/HardwareTimer_OutputInput_test.ino @@ -375,7 +375,6 @@ void loop() /********* Output test ***/ test_step++; - MyTim_output->setMode(Output1_channel, TIMER_OUTPUT_COMPARE, NC); MyTim_output->setOverflow((1000000 / OUTPUT_FREQUENCY), MICROSEC_FORMAT); MyTim_output->attachInterrupt(output_Update_IT_callback); MyTim_output->resume(); diff --git a/examples/Peripherals/HardwareTimer/Timebase_callback/Timebase_callback.ino b/examples/Peripherals/HardwareTimer/Timebase_callback/Timebase_callback.ino index 4d57fa6..74ca613 100644 --- a/examples/Peripherals/HardwareTimer/Timebase_callback/Timebase_callback.ino +++ b/examples/Peripherals/HardwareTimer/Timebase_callback/Timebase_callback.ino @@ -31,7 +31,6 @@ void setup() // configure pin in output mode pinMode(pin, OUTPUT); - MyTim->setMode(2, TIMER_OUTPUT_COMPARE); // In our case, channekFalling is configured but not really used. Nevertheless it would be possible to attach a callback to channel compare match. MyTim->setOverflow(10, HERTZ_FORMAT); // 10 Hz MyTim->attachInterrupt(Update_IT_callback); MyTim->resume();