Make DCmotor compile for 328p target. Still works needs to be done for a proper imple...
authorEbersold Andre <aebersol@LAPTOP-DEDE.localdomain>
Tue, 21 Dec 2021 19:02:27 +0000 (20:02 +0100)
committerEbersold Andre <aebersol@LAPTOP-DEDE.localdomain>
Tue, 21 Dec 2021 19:02:27 +0000 (20:02 +0100)
Application/DCMotor/328p_DCMotor.cpp
Application/DCMotor/Led0.h
Application/DCMotor/main.cpp
HAL/AVR/328p_Pwm.cpp

index 19d897aa4f60b7c4fe876db1bfa310faccb8ec8f..3f7fa1e59bade5ba4a111a71ee4a0246e9f5ac49 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <Platform/IParameterHandler.h>
 #include <Metadata/DCMotorParamIds.h>
-#include "Led0.h"
 
 #include "DCMotor.h"
 #if  defined (__AVR_ATmega32U4__)
@@ -109,7 +108,7 @@ Motor::onWriteValue(const uint8_t paramID,const Float32_t _val)
 
 void 
 Motor::enable(bool _val)
-
+{
     if ( _val != 0 )
     {
        (*m_Port)  |= _BV( PIN_MOTOR_ENABLE);
index e8f42094aa474f886171df83555450031479812a..9c88c45d373d4b0c42b6b55d36fbe1c14affa6b2 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef __LED0_H__
+#define __LED0_H__
+
 /**
  * \brief simple class for port access for LEDs
  *
@@ -50,3 +53,4 @@ class Led0
       IParameterHandler *m_Param;
 };
 
+#endif
index 6d313af04d8b1a35c9d600f507bb996167f492ff..3d14737e58e948b99540b21e7b95b986c0a50b81 100644 (file)
@@ -171,6 +171,7 @@ int main(void)
    AvrPwm               pwmA;               
 #else
    Led0                 led(&PORTB, &DDRB, PINB5,&gParam);
+   AvrPwm               pwmA;               
 #endif   
    AvrUart              uart(IUart::BAUD_9600,IUart::PARITY_NONE,IUart::STB_ONE);
    AvrADC               gAdc;
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f5a96e561a87f50c42437f437e283a54591092c8 100644 (file)
@@ -0,0 +1,45 @@
+#include "HAL/Abstract/IPwm.h"
+
+
+#if 0
+static Motor::pinMapping_t GmA = {PINB7,PINB6,0};
+
+  , m_MotorA(&OCR0A,&TCCR0A,GmA,COM0A0,_p) 
+#if ! defined (__AVR_ATmega32U4__)
+  , m_MotorB(&OCR2B,&TCCR2A,GmB,COM2B0,_p)
+#endif
+#endif
+
+#define USE_T1 1
+///
+AvrPwm::AvrPwm() 
+       : IPwm()
+{
+  //_init();
+}
+
+/// From Interface
+void
+AvrPwm::enable(const Bool_t _OnOff) const 
+{
+}
+
+
+/// From Interface
+void
+AvrPwm::setFreq(Uint16_t freq) const
+{
+}
+
+
+/// From Interface
+void
+AvrPwm::setDutyCycle(const Uint8_t _d) const
+{
+#ifdef USE_T1
+    //OCR1C =   (4 * _d);
+#else
+    //OCR0A = _d;
+#endif
+}
+