a

Dependencies:   mbed mbed-rtos

Committer:
alexpirciu
Date:
Thu Mar 28 07:44:42 2019 +0000
Revision:
1:ceee5a608e7c
assa

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alexpirciu 1:ceee5a608e7c 1 /**
alexpirciu 1:ceee5a608e7c 2 ******************************************************************************
alexpirciu 1:ceee5a608e7c 3 * @file VNH.hpp
alexpirciu 1:ceee5a608e7c 4 * @author RBRO/PJ-IU
alexpirciu 1:ceee5a608e7c 5 * @version V1.0.0
alexpirciu 1:ceee5a608e7c 6 * @date day-month-2017
alexpirciu 1:ceee5a608e7c 7 * @brief This file contains the class declaration for the VNH Bridge Driver
alexpirciu 1:ceee5a608e7c 8 * functionality.
alexpirciu 1:ceee5a608e7c 9 ******************************************************************************
alexpirciu 1:ceee5a608e7c 10 */
alexpirciu 1:ceee5a608e7c 11
alexpirciu 1:ceee5a608e7c 12 /* Inclusion guard */
alexpirciu 1:ceee5a608e7c 13 #ifndef VNH_HPP
alexpirciu 1:ceee5a608e7c 14 #define VNH_HPP
alexpirciu 1:ceee5a608e7c 15
alexpirciu 1:ceee5a608e7c 16 /* The mbed library */
alexpirciu 1:ceee5a608e7c 17 #include <mbed.h>
alexpirciu 1:ceee5a608e7c 18 /* Functions to compute common mathematical operations and transformations */
alexpirciu 1:ceee5a608e7c 19 #include <cmath>
alexpirciu 1:ceee5a608e7c 20
alexpirciu 1:ceee5a608e7c 21 namespace drivers{
alexpirciu 1:ceee5a608e7c 22 // ! Current getter interface
alexpirciu 1:ceee5a608e7c 23 class ICurrentGetter{
alexpirciu 1:ceee5a608e7c 24 public:
alexpirciu 1:ceee5a608e7c 25 virtual float GetCurrent(void)=0;
alexpirciu 1:ceee5a608e7c 26 };
alexpirciu 1:ceee5a608e7c 27
alexpirciu 1:ceee5a608e7c 28 /**
alexpirciu 1:ceee5a608e7c 29 * @brief Command setter interface.
alexpirciu 1:ceee5a608e7c 30 *
alexpirciu 1:ceee5a608e7c 31 */
alexpirciu 1:ceee5a608e7c 32 class ICommandSetter{
alexpirciu 1:ceee5a608e7c 33 public:
alexpirciu 1:ceee5a608e7c 34 virtual void Run(float pwm);
alexpirciu 1:ceee5a608e7c 35 };
alexpirciu 1:ceee5a608e7c 36
alexpirciu 1:ceee5a608e7c 37 //! VNH class.
alexpirciu 1:ceee5a608e7c 38 /*!
alexpirciu 1:ceee5a608e7c 39 * It is used for implementing motor bridge control.
alexpirciu 1:ceee5a608e7c 40 * */
alexpirciu 1:ceee5a608e7c 41 class VNH:public ICurrentGetter, public ICommandSetter
alexpirciu 1:ceee5a608e7c 42 {
alexpirciu 1:ceee5a608e7c 43 public:
alexpirciu 1:ceee5a608e7c 44 /* Constructor */
alexpirciu 1:ceee5a608e7c 45 VNH(PinName, PinName, PinName, PinName);
alexpirciu 1:ceee5a608e7c 46 /* Destructor */
alexpirciu 1:ceee5a608e7c 47 ~VNH();
alexpirciu 1:ceee5a608e7c 48 /* Start */
alexpirciu 1:ceee5a608e7c 49 void Start(void);
alexpirciu 1:ceee5a608e7c 50 /* Stop */
alexpirciu 1:ceee5a608e7c 51 void Stop(void);
alexpirciu 1:ceee5a608e7c 52 /* Run */
alexpirciu 1:ceee5a608e7c 53 void Run(float speed);
alexpirciu 1:ceee5a608e7c 54 /* Brake */
alexpirciu 1:ceee5a608e7c 55 void Brake();
alexpirciu 1:ceee5a608e7c 56 /* Inverse */
alexpirciu 1:ceee5a608e7c 57 void Inverse(float f_speed);
alexpirciu 1:ceee5a608e7c 58 /* Get current */
alexpirciu 1:ceee5a608e7c 59 float GetCurrent(void);
alexpirciu 1:ceee5a608e7c 60
alexpirciu 1:ceee5a608e7c 61 private:
alexpirciu 1:ceee5a608e7c 62 /* Go current */
alexpirciu 1:ceee5a608e7c 63 void Go(float speed);
alexpirciu 1:ceee5a608e7c 64 /* increment member */
alexpirciu 1:ceee5a608e7c 65 float increment;
alexpirciu 1:ceee5a608e7c 66 /* current speed member */
alexpirciu 1:ceee5a608e7c 67 float current_speed;
alexpirciu 1:ceee5a608e7c 68 /* PWM */
alexpirciu 1:ceee5a608e7c 69 PwmOut pwm;
alexpirciu 1:ceee5a608e7c 70 /* pin A */
alexpirciu 1:ceee5a608e7c 71 DigitalOut ina;
alexpirciu 1:ceee5a608e7c 72 /* pin B */
alexpirciu 1:ceee5a608e7c 73 DigitalOut inb;
alexpirciu 1:ceee5a608e7c 74 /* current value */
alexpirciu 1:ceee5a608e7c 75 AnalogIn current;
alexpirciu 1:ceee5a608e7c 76 };
alexpirciu 1:ceee5a608e7c 77
alexpirciu 1:ceee5a608e7c 78
alexpirciu 1:ceee5a608e7c 79 }; // namespace drivers
alexpirciu 1:ceee5a608e7c 80
alexpirciu 1:ceee5a608e7c 81
alexpirciu 1:ceee5a608e7c 82 #endif