74 lines
2.0 KiB
C++
74 lines
2.0 KiB
C++
#ifndef PRG_342_H
|
|
#define PRG_342_H
|
|
|
|
#include "Arduino.h"
|
|
|
|
class PRG_342 {
|
|
public:
|
|
PRG_342(); // Standardkonstruktor
|
|
PRG_342(float k_faktor);
|
|
~PRG_342(); // Standarddestruktor
|
|
|
|
unsigned int ActOut;
|
|
static const int TORQUE_OUT_PIN = DAC1;
|
|
|
|
unsigned int getSetPoint(unsigned char format);
|
|
unsigned int getOutVolt();
|
|
void tareTorque();
|
|
void tareAngle();
|
|
void updateActOut(int actTorque);
|
|
int getTorque(int offset = true);
|
|
//int getTorque(int offset, unsigned int COUNTS);
|
|
int getTorque(int offset, float ALPHA);
|
|
int getAngle();
|
|
static volatile bool isRunning;
|
|
//void setOutput(unsigned int value);
|
|
//void setOutput(unsigned int value, bool noLimits = false, bool onlyWhenRunning = false);
|
|
void setOutput(unsigned int value, bool onlyWhenRunning = false);
|
|
void setOutput(int startValue, int endValue, int mA_per_ms);
|
|
void safeShutdown();
|
|
void safeShutdown(unsigned int time);
|
|
void safeShutdown(unsigned int time, unsigned int value);
|
|
void DynDecog(unsigned int actValue);
|
|
void AutoDecog();
|
|
|
|
float getRotationSpeed();
|
|
|
|
private:
|
|
int getActTorque();
|
|
void updateActTorqueOut();
|
|
void updateValA0();
|
|
void updateValA1();
|
|
static void updateEncoder(); // Statische ISR-Funktion
|
|
float K_FAKTOR;
|
|
|
|
static volatile int encoderPos; // Encoderposition
|
|
static volatile int lastEncoderPos; // Encoderposition
|
|
static volatile int lastEncoded; // Letzter enkodierter Zustand
|
|
static volatile int ANGLE; // Winkel
|
|
|
|
static const int EncoderPinA = 22;
|
|
static const int EncoderPinB = 23;
|
|
static const int EncoderPinN = 24;
|
|
|
|
static const int DMS_PIN = A0;
|
|
static const int EXTSET_PIN = A1;
|
|
static const int ACT_OUT_PIN = DAC0;
|
|
|
|
static int valA0;
|
|
static int valA1;
|
|
|
|
static int filteredValA1;
|
|
|
|
float exponentialFilter(float currentValue, float previousFilteredValue, float alpha);
|
|
|
|
int TORQUE;
|
|
int OFFSET;
|
|
unsigned int SETPOINT;
|
|
unsigned long lastSpeedCalcTime;
|
|
int lastAngle;
|
|
|
|
};
|
|
|
|
#endif
|