Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
#ifndef CompInterface_h
#define CompInterface_h
#include "Arduino.h"
#include "HardwareConnector.h"
#include "SimulationConnector.h"
class CompInterface {
  private:
  boolean simulation;
  
  public:
  CompInterface();
  void resetTick();
  void simulate(boolean active);
};
#endif

This file is not generated by KIELER. It includes the interface header and the header of the SSCharts-generated FlightController, which will be output in c, not explicit for Arduino.

In the setup and loop methods the reset and tick functions of the FlightController are triggered, while before the tick function the instanced CompInterface is notified about a new tick.The CompInterface represents the communication interface to the sensors and actuators. It has a boolean, which knows if a simulation or real flight is running and gives the ability to get notified about a new tick.

Since the Arduino supports C++, most custom routines are written in it. This gives the ability to use classes for example.

CompInterface.cpp

Code Block
languagecpp
#include "Arduino.h"
#include "CompInterface.h"
boolean simulation;
HardwareConnector connector;
CompInterface::CompInterface() {
  simulation = false;
}
void CompInterface::resetTick() { 
  //TODO: Implement some code 
}
void CompInterface::simulate(boolean active) {
  simulation = active;
}

This file is just the implementation of the CompInterface.h