mirror of
https://gitlab.com/fabinfra/fabhardware/absaugungsklappensteuerung.git
synced 2025-03-12 23:01:52 +01:00
erste Aenderungen an Adc.
This commit is contained in:
parent
ce1d136257
commit
c190169d4e
@ -25,6 +25,10 @@ KlappenSteuerung::~KlappenSteuerung()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KlappenSteuerung::setupStatic(){
|
||||||
|
AnalogDigital::setupStatic();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Methods
|
// Methods
|
||||||
//
|
//
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
// Public attributes
|
// Public attributes
|
||||||
//
|
//
|
||||||
|
|
||||||
|
static void setupStatic();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pinA
|
* @param pinA
|
||||||
|
@ -1,10 +1,46 @@
|
|||||||
|
|
||||||
#include "analogDigital.h"
|
#include "analogDigital.h"
|
||||||
|
|
||||||
|
uint8_t AnalogDigital::aktuellerKanal = 0;
|
||||||
|
bool AnalogDigital::kanalFrei = true;
|
||||||
|
|
||||||
void AnalogDigital::setup(){
|
uint8_t AnalogDigital::mux;
|
||||||
Motor::setup();
|
uint8_t AnalogDigital::ref;
|
||||||
|
uint8_t AnalogDigital::la;
|
||||||
|
|
||||||
|
void AnalogDigital::setupStatic()
|
||||||
|
{
|
||||||
|
|
||||||
|
ADCSRA &= ~7;
|
||||||
|
ADCSRA |= ADC_PRESCALER;
|
||||||
|
|
||||||
|
ADCSRB = 5; // Timer/Counter1 compare match B
|
||||||
|
setLeftAdjust(0);
|
||||||
|
setRef(3); // Internal 1.1V voltage reference with external capacitor at AREF pin
|
||||||
|
setAdcAdmux();
|
||||||
|
|
||||||
ADCSRA &= ~7 ;
|
|
||||||
ADCSRA |= ADC_PRESCALER ;
|
}
|
||||||
|
|
||||||
|
void AnalogDigital::setMux(uint8_t mux)
|
||||||
|
{
|
||||||
|
AnalogDigital::mux = mux & 7;
|
||||||
|
AnalogDigital::setAdcAdmux();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalogDigital::setRef(uint8_t ref)
|
||||||
|
{
|
||||||
|
AnalogDigital::ref = ref & 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalogDigital::setLeftAdjust(uint8_t la)
|
||||||
|
{
|
||||||
|
AnalogDigital::la = la & 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalogDigital::setAdcAdmux()
|
||||||
|
{
|
||||||
|
ADMUX = (AnalogDigital::mux << MUX0) |
|
||||||
|
(AnalogDigital::ref << REFS0) |
|
||||||
|
(AnalogDigital::la << ADLAR);
|
||||||
}
|
}
|
@ -56,10 +56,33 @@
|
|||||||
|
|
||||||
class AnalogDigital : public Motor{
|
class AnalogDigital : public Motor{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
//AnalogDigital();
|
||||||
|
|
||||||
|
static void setupStatic();
|
||||||
|
static bool setAdcKanal(uint8_t kanal);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
static void setMux(uint8_t mux);
|
||||||
|
static void setRef(uint8_t ref);
|
||||||
|
static void setLeftAdjust(uint8_t la);
|
||||||
|
static void setAdcAdmux();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
static uint8_t mux;
|
||||||
|
static uint8_t ref;
|
||||||
|
static uint8_t la;
|
||||||
|
|
||||||
|
|
||||||
|
static uint8_t aktuellerKanal;
|
||||||
|
static bool kanalFrei ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void setup();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,3 +22,6 @@ void ArduinoAnpassung::loop(){
|
|||||||
zeiger = zeiger->getNachfolgerElement();
|
zeiger = zeiger->getNachfolgerElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ KlappenSteuerung klappe1 (M1A , M1B , M1SENSE , 5 );
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// put your setup code here, to run once:
|
// put your setup code here, to run once:
|
||||||
|
KlappenSteuerung::setupStatic();
|
||||||
KlappenSteuerung::setMotorPwmPin(TIMER1_PWM_PIN);
|
KlappenSteuerung::setMotorPwmPin(TIMER1_PWM_PIN);
|
||||||
KlappenSteuerung::setup();
|
KlappenSteuerung::setup();
|
||||||
pinMode(LED_BUILTIN , OUTPUT);
|
pinMode(LED_BUILTIN , OUTPUT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user