added foo for example of the interface principle

interrupts
polymurph 4 years ago
parent 8c7a26eb04
commit 41bfb2cdd7

@ -0,0 +1,15 @@
#ifndef __PINPC_HPP__
#define __PINPC_HPP__
#include <iostream>
struct Pin_PC : Pin<Pin_PC>
{
void writeImpl(bool logic)
{
std::cout << "PC pin set to " << logic << std::endl;
}
};
#endif // __PINPC_HPP__

@ -16,6 +16,14 @@ CommandManager commander;
Pin_Raspberry rpin;
Pin_PC pcpin;
template<typename derivation>
void baa(Pin<derivation>& p)
{
p.write(true);
}
void dummy()
{
rpin.write(1);
@ -23,10 +31,19 @@ void dummy()
}
void foo()
{
std::cout << "foo" << std::endl;
baa(rpin);
baa(pcpin);
}
int main(int argc, char *argv[])
{
std::cout << "Main Begin" << std::endl;
commander.addNewCommand("dummy", "The test command for testing the test", dummy);
commander.addNewCommand("foo", "The test command for foo was called", foo);
commander(argv[1]);
std::cout << "Main End" << std::endl;
return 1;

@ -7,5 +7,6 @@
#include "./utils/commandManager.h"
#include "./interfaces/pin.hpp"
#include "bsl/csl/raspberry/peripherals/pinRaspberry.hpp"
#include "bsl/csl/PC/peripherals/pinPC.hpp"
#endif // __MAIN_HPP__

Binary file not shown.
Loading…
Cancel
Save