Tohshiba motor driver IC TA8429 class

Dependents:   camera_turret_v2

Committer:
macht
Date:
Mon Jul 07 09:55:53 2014 +0000
Revision:
0:a56d6efd9c85
TA8429 motor driver IC class

Who changed what in which revision?

UserRevisionLine numberNew contents of line
macht 0:a56d6efd9c85 1 #include "TA8429.h"
macht 0:a56d6efd9c85 2
macht 0:a56d6efd9c85 3 TA8429::TA8429(PinName in1,PinName in2,float frequency):in1_ (in1),in2_(in2){
macht 0:a56d6efd9c85 4 in1_.period(1/frequency);
macht 0:a56d6efd9c85 5 in2_.period(1/frequency);
macht 0:a56d6efd9c85 6 }
macht 0:a56d6efd9c85 7
macht 0:a56d6efd9c85 8 void TA8429::set_CW(float duty){
macht 0:a56d6efd9c85 9 if(duty < 0.0){
macht 0:a56d6efd9c85 10 duty = 0.0;
macht 0:a56d6efd9c85 11 }
macht 0:a56d6efd9c85 12 if(duty >1.0){
macht 0:a56d6efd9c85 13 duty = 1.0;
macht 0:a56d6efd9c85 14 }
macht 0:a56d6efd9c85 15 in1_ = 1.0;
macht 0:a56d6efd9c85 16 in2_ = 1.0-duty;
macht 0:a56d6efd9c85 17 }
macht 0:a56d6efd9c85 18 void TA8429::set_CCW(float duty){
macht 0:a56d6efd9c85 19 if(duty < 0.0){
macht 0:a56d6efd9c85 20 duty = 0.0;
macht 0:a56d6efd9c85 21 }
macht 0:a56d6efd9c85 22 if(duty >1.0){
macht 0:a56d6efd9c85 23 duty = 1.0;
macht 0:a56d6efd9c85 24 }
macht 0:a56d6efd9c85 25 in2_ = 1.0;
macht 0:a56d6efd9c85 26 in1_ = 1.0-duty;
macht 0:a56d6efd9c85 27 }
macht 0:a56d6efd9c85 28 void TA8429::stop(){
macht 0:a56d6efd9c85 29 in1_ = 1.0;
macht 0:a56d6efd9c85 30 in2_ = 1.0;
macht 0:a56d6efd9c85 31 }