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.
Diff: IO_pwm/IO_pwm.h
- Revision:
- 0:d0c188d2cd1c
diff -r 000000000000 -r d0c188d2cd1c IO_pwm/IO_pwm.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/IO_pwm/IO_pwm.h Sat Mar 16 01:58:24 2019 +0000
@@ -0,0 +1,35 @@
+/*
+h文件
+class 类名
+{
+public:
+ 类名::构造函数(变量参数);
+ 公有函数声明;
+protected:
+ 私有对象声明;
+ 私有变量声明;
+ 私有函数声明;
+};
+*/
+
+#ifndef IO_pwm_H_
+#define IO_pwm_H_
+#include "mbed.h"
+class IO_pwm
+{
+public:
+ IO_pwm(PinName n);
+ void pwm_io(int p_us, float dc);
+
+protected:
+ //PWM的周期=on_delay+off_delay,高电平时间=on_delay
+ int on_delay;
+ int off_delay;
+
+ PinName _n;
+ // DigitalOutr mypwm;
+ Timeout timer;
+ void toggleOn(void);
+ void toggleOff(void);
+};
+#endif