parent
4dc986dbba
commit
dc0aa76818
@ -1,29 +0,0 @@
|
|||||||
cpp_src = $(wildcard *.cpp)
|
|
||||||
#cpp_src += $(wildcard ./utils/*.cpp)
|
|
||||||
#cpp_src += $(wildcard ./driver/*.cpp)
|
|
||||||
|
|
||||||
cpp_obj = $(cpp_src:.cpp=.o)
|
|
||||||
c_obj = $(c_src:.c=.o)
|
|
||||||
CC = g++
|
|
||||||
CFLAGS = -Wall -pedantic -li2c
|
|
||||||
LDFLAGS =
|
|
||||||
EXEC = runtest
|
|
||||||
|
|
||||||
|
|
||||||
all : $(EXEC)
|
|
||||||
|
|
||||||
$(EXEC): $(cpp_obj) $(c_obj)
|
|
||||||
$(CC) -o $@ $^ $(LDFLAGS)
|
|
||||||
|
|
||||||
debug : $(EXEC)
|
|
||||||
|
|
||||||
$(EXEC): $(cpp_obj) $(c_obj)
|
|
||||||
$(CC) -g -o $@ $^ $(LDFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
|
||||||
clear
|
|
||||||
|
|
||||||
cleanall:
|
|
||||||
rm -rf $(c_obj) $(cpp_obj) $(EXEC)
|
|
||||||
clear
|
|
@ -1,42 +0,0 @@
|
|||||||
#ifndef __HW_PLATTFORM_HPP__
|
|
||||||
#define __HW_PLATTFORM_HPP__
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
//
|
|
||||||
// csl ressources
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "./../csl/implementations/dummy/dummy_pin.hpp"
|
|
||||||
|
|
||||||
//
|
|
||||||
// drivers
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "./../drivers/LED.hpp"
|
|
||||||
|
|
||||||
struct HW_plattform
|
|
||||||
{
|
|
||||||
HW_plattform():
|
|
||||||
pin_0(),
|
|
||||||
pin_1(),
|
|
||||||
led_0(pin_0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void init()
|
|
||||||
{
|
|
||||||
std::cout << "bsl init..." << std::endl;
|
|
||||||
pin_0.set(false);
|
|
||||||
pin_1.set(false);
|
|
||||||
std::cout << "...done!" << std::endl;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
Dummy_Pin pin_0, pin_1;
|
|
||||||
public:
|
|
||||||
|
|
||||||
LED<Dummy_Pin> led_0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __HW_PLATTFORM_HPP__
|
|
@ -1,37 +0,0 @@
|
|||||||
#ifndef __AVR_PIN_HPP__
|
|
||||||
#define __AVR_PIN_HPP__
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "./../../interfaces/pin.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct AVR_Pin : Pin<AVR_Pin>
|
|
||||||
{
|
|
||||||
AVR_Pin()
|
|
||||||
{
|
|
||||||
std::cout << "created AVR_Pin" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setImp(bool logic)
|
|
||||||
{
|
|
||||||
std::cout << "AVR pin set to " << logic << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleImp()
|
|
||||||
{
|
|
||||||
std::cout << "toggled AVR pin" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool getImp()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void avr_stuff()
|
|
||||||
{
|
|
||||||
std::cout << "AVR specific stuff" << std::endl;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __AVR_PIN_HPP__
|
|
@ -1,38 +0,0 @@
|
|||||||
#ifndef __DUMMY_PIN_HPP__
|
|
||||||
#define __DUMMY_PIN_HPP__
|
|
||||||
|
|
||||||
#include "./../../interfaces/pin.hpp"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
struct Dummy_Pin : Pin<Dummy_Pin>
|
|
||||||
{
|
|
||||||
Dummy_Pin()
|
|
||||||
{
|
|
||||||
std::cout << "created Dummy_Pin" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setImp(bool logic)
|
|
||||||
{
|
|
||||||
std::cout << "Dummy pin set to " << logic << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleImp()
|
|
||||||
{
|
|
||||||
std::cout << "toggled Dummy pin" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool getImp()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dummy_stuff()
|
|
||||||
{
|
|
||||||
std::cout << "dummy specific stuff" << std::endl;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __DUMMY_PIN_HPP__
|
|
@ -1,37 +0,0 @@
|
|||||||
#ifndef __STM_PIN_HPP__
|
|
||||||
#define __STM_PIN_HPP__
|
|
||||||
|
|
||||||
#include "./../../interfaces/pin.hpp"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
truct STM32_Pin : Pin<STM32_Pin>
|
|
||||||
{
|
|
||||||
STM32_Pin()
|
|
||||||
{
|
|
||||||
std::cout << "created STM32_Pin" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setImp(bool logic)
|
|
||||||
{
|
|
||||||
std::cout << "stm32 pin set to " << logic << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleImp()
|
|
||||||
{
|
|
||||||
std::cout << "toggled stm32 pin" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool getImp()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void STM32_stuff()
|
|
||||||
{
|
|
||||||
std::cout << "STM_32 specific stuff" << std::endl;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __STM_PIN_HPP__
|
|
@ -1,23 +0,0 @@
|
|||||||
#ifndef __PIN_HPP__
|
|
||||||
#define __PIN_HPP__
|
|
||||||
|
|
||||||
template <typename Derived>
|
|
||||||
struct Pin
|
|
||||||
{
|
|
||||||
void set(bool logic)
|
|
||||||
{
|
|
||||||
static_cast<Derived*>(this)->setImp(logic);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggle()
|
|
||||||
{
|
|
||||||
static_cast<Derived*>(this)->toggleImp();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get(void)
|
|
||||||
{
|
|
||||||
return static_cast<Derived*>(this)->getImp();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __PIN_HPP__
|
|
@ -1,35 +0,0 @@
|
|||||||
#ifndef __LED_HPP__
|
|
||||||
#define __LED_HPP__
|
|
||||||
|
|
||||||
#include "./../csl/interfaces/pin.hpp"
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class LED
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
LED(Pin<T>& pin) :
|
|
||||||
pin(pin)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void turnOn()
|
|
||||||
{
|
|
||||||
pin.set(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void turnOff()
|
|
||||||
{
|
|
||||||
pin.set(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggle()
|
|
||||||
{
|
|
||||||
pin.toggle();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Pin<T>& pin;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __LED_HPP__
|
|
@ -1,16 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "./bsl/hw_plattform.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
HW_plattform hw;
|
|
||||||
hw.init();
|
|
||||||
|
|
||||||
//hw.pin_1.set(true);
|
|
||||||
|
|
||||||
hw.led_0.turnOn();
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
Binary file not shown.
@ -1,6 +1,5 @@
|
|||||||
#include "gpio.hpp"
|
#include "gpio.hpp"
|
||||||
#include "../../bsl_nucleo_f042k6.h"
|
#include "../Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f042x6.h"
|
||||||
#include "./../../../csl/stm32f042/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f042x6.h"
|
|
||||||
|
|
||||||
#define PIN_COUNT 20
|
#define PIN_COUNT 20
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
add_subdirectory(gpio)
|
|
@ -1,6 +0,0 @@
|
|||||||
add_library(stmGpio gpio.cpp)
|
|
||||||
|
|
||||||
target_compile_options(stmGpio PRIVATE ${C_FLAGS})
|
|
||||||
target_compile_definitions(stmGpio PRIVATE ${C_DEFS})
|
|
||||||
target_include_directories(stmGpio PUBLIC ${INTERFACES_DIR} ${CSL_INCLUDES})
|
|
||||||
add_library(sub::gpio ALIAS stmGpio)
|
|
Loading…
Reference in new issue