Made the LED class and it's worting at it is now wrotten but wehn i pass &ledPin i get : 'Pin' is an inaccessible base of STM_Pin<(Pin_no)3, (GPIO_Port)1207960576>
parent
9984ab9fe9
commit
7b65c95242
@ -0,0 +1,7 @@
|
|||||||
|
add_library(ledDriver led.cpp)
|
||||||
|
|
||||||
|
target_compile_options(ledDriver PRIVATE ${C_FLAGS})
|
||||||
|
target_compile_definitions(ledDriver PRIVATE ${C_DEFS})
|
||||||
|
target_include_directories(ledDriver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
add_library(sub::led ALIAS ledDriver)
|
@ -1,18 +1,30 @@
|
|||||||
#include "led.hpp"
|
#include "led.hpp"
|
||||||
|
|
||||||
|
Led::Led(Pin* pin_ptr)
|
||||||
|
{
|
||||||
|
pin = pin_ptr;
|
||||||
|
pin->init();
|
||||||
|
pin->setMode(Pin::mode::output);
|
||||||
|
pin->setSpeed(Pin::speed::fast);
|
||||||
|
}
|
||||||
|
|
||||||
|
Led::~Led()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Pin::on()
|
void Led::on()
|
||||||
{
|
{
|
||||||
pin.write(true);
|
pin->write(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pin::off()
|
void Led::off()
|
||||||
{
|
{
|
||||||
pin.write(false);
|
pin->write(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pin::toggle()
|
void Led::toggle()
|
||||||
{
|
{
|
||||||
pin.toggle();
|
pin->toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in new issue