auf VSCode mit PlatformIO umgestellt.

This commit is contained in:
Toberfra 2022-02-04 19:22:43 +01:00
parent 3b9117669d
commit ba5ee42fce
13 changed files with 258 additions and 149 deletions

5
Arduino/motor/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

View File

@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

46
Arduino/motor/lib/README Normal file
View File

@ -0,0 +1,46 @@
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html

View File

@ -0,0 +1,14 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino

View File

@ -0,0 +1,23 @@
#include "KlappenAblauf.h"
// Constructors/Destructors
//
KlappenAblauf::~KlappenAblauf()
{
}
//
// Methods
//
// Accessor methods
//
// Other methods
//

View File

@ -0,0 +1,52 @@
#ifndef KLAPPENABLAUF_H
#define KLAPPENABLAUF_H
#include "KlappenSteuerung.h"
/**
* class KlappenAblauf
*
*/
class KlappenAblauf : public KlappenSteuerung
{
public:
// Constructors/Destructors
//
/**
* Empty Constructor
*/
KlappenAblauf();
/**
* Empty Destructor
*/
virtual ~KlappenAblauf();
// Static Public attributes
//
// Public attributes
//
protected:
// Static Protected attributes
//
// Protected attributes
//
private:
// Static Private attributes
//
// Private attributes
//
};
#endif // KLAPPENABLAUF_H

View File

@ -3,8 +3,22 @@
// Constructors/Destructors // Constructors/Destructors
// //
KlappenSteuerung::KlappenSteuerung()
/**
* @param pinA
* @param pinB
* @param pinPwm
* @param pinSense
* @param id
*/
KlappenSteuerung::KlappenSteuerung(int pin_A, int pin_B, int pin_Pwm, int pin_Sense, int i_d)
{ {
initAttributes();
pinA = pin_A;
pinB = pin_B;
pinPwm = pin_Pwm;
pinSense = pin_Sense;
id = i_d;
} }
KlappenSteuerung::~KlappenSteuerung() KlappenSteuerung::~KlappenSteuerung()
@ -24,16 +38,6 @@ KlappenSteuerung::~KlappenSteuerung()
// //
/**
* @param pinA
* @param pinB
* @param pinPwm
* @param pinSense
*/
KlappenSteuerung::KlappenSteuerung(int pinA, int pinB, int pinPwm, int pinSense)
{
}
/** /**
*/ */
@ -56,4 +60,13 @@ void KlappenSteuerung::setOpen(bool open)
{ {
} }
void KlappenSteuerung::initAttributes()
{
pinA = -1;
pinB = -1;
pinPwm = -1;
pinSense = -1;
id = -1;
status = NICHTS;
}

View File

@ -2,6 +2,7 @@
#ifndef KLAPPENSTEUERUNG_H #ifndef KLAPPENSTEUERUNG_H
#define KLAPPENSTEUERUNG_H #define KLAPPENSTEUERUNG_H
#include "statusKlappen.h"
/** /**
* class KlappenSteuerung * class KlappenSteuerung
@ -18,7 +19,7 @@ public:
/** /**
* Empty Constructor * Empty Constructor
*/ */
KlappenSteuerung(); //KlappenSteuerung();
/** /**
* Empty Destructor * Empty Destructor
@ -38,8 +39,9 @@ public:
* @param pinB * @param pinB
* @param pinPwm * @param pinPwm
* @param pinSense * @param pinSense
* @param id
*/ */
KlappenSteuerung(int pinA, int pinB, int pinPwm, int pinSense); KlappenSteuerung(int pinA, int pinB, int pinPwm, int pinSense, int id);
/** /**
@ -62,14 +64,24 @@ protected:
// //
// Protected attributes // Protected attributes
// //
int pinA;
int pinB;
int pinPwm;
int pinSense;
int id;
statusKlappen status;
private: private:
// Static Private attributes // Static Private attributes
// //
// Private attributes // Private attributes
// //
void initAttributes();
}; };

View File

@ -1,10 +1,18 @@
#include <Arduino.h>
#include "pins.h" #include "pins.h"
#include "KlappenSteuerung.h" #include "KlappenSteuerung.h"
KlappenSteuerung klappe1 (M1A , M1B , M1PWM , M1SENSE);
KlappenSteuerung klappe2 (M2A , M2B , M2PWM , M2SENSE); void Ablauf();
KlappenSteuerung klappe3 (M3A , M3B , M3PWM , M3SENSE); void AblaufSekunde();
KlappenSteuerung klappe4 (M4A , M4B , M4PWM , M4SENSE);
KlappenSteuerung klappe1 (M1A , M1B , M1PWM , M1SENSE , 5 );
KlappenSteuerung klappe2 (M2A , M2B , M2PWM , M2SENSE , 2 );
KlappenSteuerung klappe3 (M3A , M3B , M3PWM , M3SENSE , 23 );
KlappenSteuerung klappe4 (M4A , M4B , M4PWM , M4SENSE , 1 );
void setup() { void setup() {
// put your setup code here, to run once: // put your setup code here, to run once:
@ -54,7 +62,7 @@ void AblaufSekunde(){
klappe1.setOpen(false); klappe1.setOpen(false);
break; break;
case19: case 19:
sekunden = 0; sekunden = 0;
break; break;
} }

View File

@ -0,0 +1,15 @@
#ifndef STATUS_H
#define STATUS_H
typedef enum statusKlappenenum{
NICHTS,
}statusKlappen;
#endif

11
Arduino/motor/test/README Normal file
View File

@ -0,0 +1,11 @@
This directory is intended for PlatformIO Unit Testing and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html

View File

@ -1,129 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<XMI xmi.version="1.2" timestamp="2022-02-02T21:12:00" verified="false" xmlns:UML="http://schema.omg.org/spec/UML/1.4">
<XMI.header>
<XMI.documentation>
<XMI.exporter>umbrello uml modeller 2.32.0 http://umbrello.kde.org</XMI.exporter>
<XMI.exporterVersion>1.7.3</XMI.exporterVersion>
<XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
</XMI.documentation>
<XMI.metamodel xmi.name="UML" xmi.version="1.4" href="UML.xml"/>
</XMI.header>
<XMI.content>
<UML:Model xmi.id="m1" name="UML-Modell" isSpecification="false" isAbstract="false" isRoot="false" isLeaf="false">
<UML:Namespace.ownedElement>
<UML:Stereotype isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="folder" name="folder" namespace="m1" visibility="public"/>
<UML:Model isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="Logical_View" name="Logical View" namespace="m1" visibility="public">
<UML:Namespace.ownedElement>
<UML:Package isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="Datatypes" name="Datatypes" namespace="Logical_View" visibility="public" stereotype="folder">
<UML:Namespace.ownedElement>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uHd4fYxxwX5p4" name="char" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uvEuVFcsxTFpM" name="int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="ulvWsUG8Q1dbO" name="float" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uwm0PtgPoGv1u" name="double" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uIUzn3PLbJuWl" name="bool" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uapwjUxCuvcgU" name="string" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="ur6wh8mZVQPBS" name="unsigned char" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uJtFSPuzjkFAt" name="signed char" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="u5gZ2Px4TuQKy" name="unsigned int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uCsWPp0Q3kqNS" name="signed int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uW69bFoN74Yxb" name="short int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="ugRmP5fLHa2r3" name="unsigned short int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="u7LZSzfzMmNoq" name="signed short int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uCN7Sh0EjtgXi" name="long int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="u6l69uvD6cED8" name="signed long int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="urw6ubFdv9fvw" name="unsigned long int" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="u99A9hBP6ywUd" name="long double" namespace="Datatypes" visibility="public"/>
<UML:DataType isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="ukmOb66JjdaUJ" name="wchar_t" namespace="Datatypes" visibility="public"/>
</UML:Namespace.ownedElement>
</UML:Package>
<UML:Class isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uypPq7rhMJC4h" name="KlappenSteuerung" namespace="Logical_View" visibility="public">
<UML:Classifier.feature>
<UML:Operation isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uEZ9GITRhtNdv" name="KlappenSteuerung" visibility="public" isQuery="false" isOverride="false" isVirtual="false" isInline="false">
<UML:BehavioralFeature.parameter>
<UML:Parameter isSpecification="false" xmi.id="u3NV25zdQ8NJW" name="pinA" visibility="private" type="uvEuVFcsxTFpM" value=""/>
<UML:Parameter isSpecification="false" xmi.id="ucFMUyQuuAfYX" name="pinB" visibility="private" type="uvEuVFcsxTFpM" value=""/>
<UML:Parameter isSpecification="false" xmi.id="udm06oR97zSVW" name="pinPwm" visibility="private" type="uvEuVFcsxTFpM" value=""/>
<UML:Parameter isSpecification="false" xmi.id="uRFODQSPSaavR" name="pinSense" visibility="private" type="uvEuVFcsxTFpM" value=""/>
</UML:BehavioralFeature.parameter>
</UML:Operation>
<UML:Operation isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uzQgrta2AvAyk" name="setup" visibility="public" isQuery="false" isOverride="false" isVirtual="false" isInline="false"/>
<UML:Operation isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uzMuHoGXELk3m" name="loop" visibility="public" isQuery="false" isOverride="false" isVirtual="false" isInline="false"/>
<UML:Operation isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="uWMWIj2gVnZEo" name="setOpen" visibility="public" isQuery="false" isOverride="false" isVirtual="false" isInline="false">
<UML:BehavioralFeature.parameter>
<UML:Parameter isSpecification="false" xmi.id="uhsDiTF2njq06" name="open" visibility="private" type="uIUzn3PLbJuWl" value=""/>
</UML:BehavioralFeature.parameter>
</UML:Operation>
</UML:Classifier.feature>
</UML:Class>
</UML:Namespace.ownedElement>
<XMI.extension xmi.extender="umbrello">
<diagrams resolution="96">
<diagram xmi.id="uLSyEXfCNuoJe" name="Klassendiagramm" type="1" documentation="" backgroundcolor="#ffffff" fillcolor="#ffffc0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" griddotcolor="#f7f7f7" linecolor="#ff0000" linewidth="0" textcolor="#000000" usefillcolor="1" showattribassocs="1" showatts="1" showattsig="1" showops="1" showopsig="1" showpackage="1" showpubliconly="0" showscope="1" showstereotype="2" localid="-1" showgrid="0" snapgrid="0" snapcsgrid="0" snapx="25" snapy="25" zoom="100" canvasheight="79" canvaswidth="772" isopen="1">
<widgets>
<classwidget xmi.id="uypPq7rhMJC4h" localid="umnawQru2IH3b" textcolor="#000000" linecolor="#ff0000" linewidth="0" usefillcolor="1" usesdiagramfillcolor="0" usesdiagramusefillcolor="0" fillcolor="#ffffc0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" autoresize="0" x="-441" y="-163" width="772" height="79" isinstance="0" showstereotype="2" showoperations="1" showpubliconly="0" showopsigs="601" showpackage="1" showscope="1" showattributes="1" showattsigs="601" showstereotype="2"/>
</widgets>
<messages/>
<associations/>
</diagram>
</diagrams>
</XMI.extension>
</UML:Model>
<UML:Model isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="Use_Case_View" name="Use Case View" namespace="m1" visibility="public">
<UML:Namespace.ownedElement/>
</UML:Model>
<UML:Model isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="Component_View" name="Component View" namespace="m1" visibility="public">
<UML:Namespace.ownedElement/>
</UML:Model>
<UML:Model isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="Deployment_View" name="Deployment View" namespace="m1" visibility="public">
<UML:Namespace.ownedElement/>
</UML:Model>
<UML:Model isSpecification="false" isLeaf="false" isRoot="false" isAbstract="false" xmi.id="Entity_Relationship_Model" name="Entity Relationship Model" namespace="m1" visibility="public">
<UML:Namespace.ownedElement/>
</UML:Model>
</UML:Namespace.ownedElement>
</UML:Model>
</XMI.content>
<XMI.extensions xmi.extender="umbrello">
<docsettings viewid="uLSyEXfCNuoJe" documentation="" uniqueid="uhsDiTF2njq06"/>
<listview>
<listitem id="Views" type="800" open="1">
<listitem id="Use_Case_View" type="802" open="1"/>
<listitem id="Entity_Relationship_Model" type="836" open="1"/>
<listitem id="Component_View" type="821" open="1"/>
<listitem id="Logical_View" type="801" open="1">
<listitem id="Datatypes" type="830" open="0">
<listitem id="uIUzn3PLbJuWl" type="829" open="0"/>
<listitem id="uHd4fYxxwX5p4" type="829" open="0"/>
<listitem id="uwm0PtgPoGv1u" type="829" open="0"/>
<listitem id="ulvWsUG8Q1dbO" type="829" open="0"/>
<listitem id="uvEuVFcsxTFpM" type="829" open="0"/>
<listitem id="u99A9hBP6ywUd" type="829" open="0"/>
<listitem id="uCN7Sh0EjtgXi" type="829" open="0"/>
<listitem id="uW69bFoN74Yxb" type="829" open="0"/>
<listitem id="uJtFSPuzjkFAt" type="829" open="0"/>
<listitem id="uCsWPp0Q3kqNS" type="829" open="0"/>
<listitem id="u6l69uvD6cED8" type="829" open="0"/>
<listitem id="u7LZSzfzMmNoq" type="829" open="0"/>
<listitem id="uapwjUxCuvcgU" type="829" open="0"/>
<listitem id="ur6wh8mZVQPBS" type="829" open="0"/>
<listitem id="u5gZ2Px4TuQKy" type="829" open="0"/>
<listitem id="urw6ubFdv9fvw" type="829" open="0"/>
<listitem id="ugRmP5fLHa2r3" type="829" open="0"/>
<listitem id="ukmOb66JjdaUJ" type="829" open="0"/>
</listitem>
<listitem id="uypPq7rhMJC4h" type="813" open="1">
<listitem id="uEZ9GITRhtNdv" type="815" open="0"/>
<listitem id="uzMuHoGXELk3m" type="815" open="0"/>
<listitem id="uWMWIj2gVnZEo" type="815" open="0"/>
<listitem id="uzQgrta2AvAyk" type="815" open="0"/>
</listitem>
<listitem id="uLSyEXfCNuoJe" type="807" label="Klassendiagramm" open="0"/>
</listitem>
<listitem id="Deployment_View" type="827" open="1"/>
</listitem>
</listview>
<codegeneration>
<codegenerator language="C++"/>
</codegeneration>
</XMI.extensions>
</XMI>