First Intreface implementation with CRTP idome

interrupts
Kerem Yollu 4 years ago
parent 68a208dc10
commit 8c7a26eb04

@ -1,5 +1,6 @@
cpp_src += $(wildcard *.cpp) cpp_src += $(wildcard *.cpp)
cpp_src += $(wildcard ./utils/*.cpp) cpp_src += $(wildcard ./utils/*.cpp)
cpp_src += $(wildcard ./interfaces/*.cpp)
#cpp_src += $(wildcard ./communication/i2c/*.cpp) #cpp_src += $(wildcard ./communication/i2c/*.cpp)
#c_src += $(wildcard ./algorithms/*.c) #c_src += $(wildcard ./algorithms/*.c)

@ -1,3 +1,15 @@
# KED # KED
Kerems and Edwins Develeppoment platform. Kerems and Edwins Develeppoment platform.
08.08.21 Kerem & Edwin
- Preparing the main implementation (dummy) of our structure which consists of :
- CSL : Chip Support Layer
- CSL for Raspberry
- CSL for STM Nucleo
- BSL : Board Support Layer
- BSL for Raspberry
- BSL for Oven Control
- Project Level
- Integrate BSL dummy fct. to our main.cpp

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

@ -0,0 +1,13 @@
#ifndef __PIN_HPP__
#define __PIN_HPP__
template <typename Derived>
struct Pin
{
void write(bool logic)
{
static_cast<Derived*>(this)->writeImpl(logic);
}
};
#endif // __PIN_HPP__

@ -14,9 +14,13 @@
CommandManager commander; CommandManager commander;
Pin_Raspberry rpin;
void dummy() void dummy()
{ {
rpin.write(1);
std::cout << "Dummy" << std::endl; std::cout << "Dummy" << std::endl;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])

@ -5,5 +5,7 @@
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include "./utils/commandManager.h" #include "./utils/commandManager.h"
#include "./interfaces/pin.hpp"
#include "bsl/csl/raspberry/peripherals/pinRaspberry.hpp"
#endif // __MAIN_HPP__ #endif // __MAIN_HPP__

Binary file not shown.
Loading…
Cancel
Save