Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: mylib/src/tim.cpp
- Revision:
- 0:fb4269aa5fb4
diff -r 000000000000 -r fb4269aa5fb4 mylib/src/tim.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mylib/src/tim.cpp Fri May 26 03:51:19 2017 +0000
@@ -0,0 +1,29 @@
+#include "tim.h"
+
+/*-----繰り返しタイマ割り込み-----*/
+Ticker flipper1;
+Ticker flipper2;
+Ticker flipper3;
+/*----------------------------*/
+
+/*------------PWM-------------*/
+PwmOut pwm1(PB_5); //tim3 ch2
+PwmOut pwm2(PA_10); //tim1 ch3
+PwmOut pwm3(PA_8); //tim1 ch1
+/*----------------------------*/
+
+
+void TIM_Init()
+{
+ /*----------Interval interrupt----------*/
+ flipper1.attach(&Flip1_Callback, 0.01);
+ flipper2.attach(&Flip2_Callback, 0.001);
+ //flipper3.attach(&Flip3_Callback, 0.001);
+ /*--------------------------------------*/
+
+ /*--------pulse width modulation--------*/
+ pwm1.period(0.0001); //10kHz
+ pwm2.period(0.0001); //10kHz
+ pwm3.period(0.0001); //10kHz
+ /*--------------------------------------*/
+}