Files
Cpp-in-Embedded-Systems/Chapter11/compile_time/hal/gpio/src/gpio.cpp
Amar Mahmutbegovic f10d0ef610 add Chapter11
2024-09-22 16:52:43 +02:00

21 lines
409 B
C++

#include <gpio.hpp>
#include <gpio_interrupt_manager.hpp>
namespace hal {
gpio::gpio(const std::function<void()> & on_press) {
on_press_ = on_press;
gpio_interrupt_manager::register_interrupt_handler(this);
}
void gpio::execute_interrupt_handler () const {
if(is_interrupt_generated())
{
clear_interrupt_flag();
if(on_press_) {
on_press_();
}
}
}
};