Tripple Controller for the TLE5206 H Bridge motor controller

Committer:
AjK
Date:
Tue Jul 05 16:08:38 2011 +0000
Revision:
5:bfc5c5cc161e
Parent:
3:b7d951c6f551
0.7 Beta See ChangeLog.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AjK 0:e2433ca2ce59 1 /*
AjK 0:e2433ca2ce59 2 Copyright (c) 2011 Andy Kirkham
AjK 0:e2433ca2ce59 3
AjK 0:e2433ca2ce59 4 Permission is hereby granted, free of charge, to any person obtaining a copy
AjK 0:e2433ca2ce59 5 of this software and associated documentation files (the "Software"), to deal
AjK 0:e2433ca2ce59 6 in the Software without restriction, including without limitation the rights
AjK 0:e2433ca2ce59 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
AjK 0:e2433ca2ce59 8 copies of the Software, and to permit persons to whom the Software is
AjK 0:e2433ca2ce59 9 furnished to do so, subject to the following conditions:
AjK 0:e2433ca2ce59 10
AjK 0:e2433ca2ce59 11 The above copyright notice and this permission notice shall be included in
AjK 0:e2433ca2ce59 12 all copies or substantial portions of the Software.
AjK 0:e2433ca2ce59 13
AjK 0:e2433ca2ce59 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
AjK 0:e2433ca2ce59 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
AjK 0:e2433ca2ce59 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AjK 0:e2433ca2ce59 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
AjK 0:e2433ca2ce59 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AjK 0:e2433ca2ce59 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
AjK 0:e2433ca2ce59 20 THE SOFTWARE.
AjK 0:e2433ca2ce59 21 */
AjK 0:e2433ca2ce59 22
AjK 3:b7d951c6f551 23 /*
AjK 3:b7d951c6f551 24 See http://mbed.org/forum/mbed/topic/2463/
AjK 3:b7d951c6f551 25 */
AjK 3:b7d951c6f551 26
AjK 0:e2433ca2ce59 27 #ifndef AJK_SIMPLETLE5206_H
AjK 0:e2433ca2ce59 28 #define AJK_SIMPLETLE5206_H
AjK 0:e2433ca2ce59 29
AjK 0:e2433ca2ce59 30 #include "LPC17xx.h"
AjK 0:e2433ca2ce59 31 #include "SimpleTLE5206Output.h"
AjK 0:e2433ca2ce59 32
AjK 0:e2433ca2ce59 33 namespace AjK {
AjK 0:e2433ca2ce59 34
AjK 0:e2433ca2ce59 35 class SimpleTLE5206 {
AjK 0:e2433ca2ce59 36
AjK 0:e2433ca2ce59 37 public:
AjK 0:e2433ca2ce59 38 enum PwmCh { NoPwm0, Pwm1, Pwm2, Pwm3, Pwm4, Pwm5, Pwm6, NumOfPwms };
AjK 0:e2433ca2ce59 39
AjK 0:e2433ca2ce59 40 protected:
AjK 0:e2433ca2ce59 41 uint32_t _duty;
AjK 0:e2433ca2ce59 42
AjK 0:e2433ca2ce59 43 SimpleTLE5206Output *_in1;
AjK 0:e2433ca2ce59 44 SimpleTLE5206Output *_in2;
AjK 0:e2433ca2ce59 45
AjK 0:e2433ca2ce59 46 void setDuty(uint32_t u);
AjK 0:e2433ca2ce59 47
AjK 0:e2433ca2ce59 48 void setMRx(PwmCh ch, uint32_t value);
AjK 0:e2433ca2ce59 49
AjK 2:c5fbe0cb8a97 50 void init(uint32_t);
AjK 0:e2433ca2ce59 51
AjK 0:e2433ca2ce59 52 public:
AjK 0:e2433ca2ce59 53
AjK 0:e2433ca2ce59 54 SimpleTLE5206() { error("We require two pins!\n"); }
AjK 0:e2433ca2ce59 55
AjK 2:c5fbe0cb8a97 56 SimpleTLE5206(SimpleTLE5206Output *in1, SimpleTLE5206Output *in2, int duty_cycle_hz);
AjK 2:c5fbe0cb8a97 57
AjK 0:e2433ca2ce59 58 SimpleTLE5206(SimpleTLE5206Output *in1, SimpleTLE5206Output *in2);
AjK 2:c5fbe0cb8a97 59
AjK 0:e2433ca2ce59 60 void setSpeed(double d);
AjK 0:e2433ca2ce59 61
AjK 0:e2433ca2ce59 62 }; /* class SimpleTLE5206 ends. */
AjK 0:e2433ca2ce59 63
AjK 0:e2433ca2ce59 64 }; /* namespace AjK ends. */
AjK 0:e2433ca2ce59 65
AjK 0:e2433ca2ce59 66 using namespace AjK;
AjK 0:e2433ca2ce59 67
AjK 0:e2433ca2ce59 68 #endif