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.
Fork of TLE5206_lib by
Diff: TLE5206_lib.cpp
- Revision:
- 0:03a724b7421c
- Child:
- 1:1117196d767b
diff -r 000000000000 -r 03a724b7421c TLE5206_lib.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/TLE5206_lib.cpp Tue Jan 29 15:32:12 2019 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#include "TLE5206_lib.h"
+
+TLE5206::TLE5206(PinName IN1,PinName IN2):pwmIN1(IN1),pwmIN2(IN2){};
+
+void TLE5206::setup(int periode_us){
+ this->pwmIN1.period_us(periode_us);
+ this->pwmIN2.period_us(periode_us);
+}
+
+void TLE5206::write(float duty_cycle){
+ if (duty_cycle < -1){
+ this->pwmIN1 = 1.0;
+ this->pwmIN2 = 0.0;
+ }else if (duty_cycle < 0){
+ this->pwmIN1 = -duty_cycle;
+ this->pwmIN2 = 0.0;
+ }else if (duty_cycle < 1){
+ this->pwmIN1 = 0.0;
+ this->pwmIN2 = duty_cycle;
+ }else {
+ this->pwmIN1 = 0.0;
+ this->pwmIN2 = 1.0;
+ }
+}
\ No newline at end of file
