From ef672e281ec2c607aac97f0f0621e84e83937545 Mon Sep 17 00:00:00 2001 From: Lisin Dmitriy Date: Fri, 7 Jun 2019 17:33:11 +0300 Subject: FEAT: Add define to disable library interrupt service --- README.rst | 3 +++ cm3cpp/irq/irq.cpp | 4 ++++ cm3cpp/irq/irq.hpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 9b7945c..5f24f8e 100644 --- a/README.rst +++ b/README.rst @@ -31,3 +31,6 @@ Library defines: - ``CM3CPP_ENABLE_IMPLISIT_DESTRUCTOR_CALLS`` — do not call ``assert(false)`` if dangerous destructor of library class is called. + + - ``CM3CPP_CUSTOM_INTERRUPT_SERVICE`` — disable IInterruptable + and leave all opencm3 interrupt functions undeclared. diff --git a/cm3cpp/irq/irq.cpp b/cm3cpp/irq/irq.cpp index bc7320a..bcff9ff 100644 --- a/cm3cpp/irq/irq.cpp +++ b/cm3cpp/irq/irq.cpp @@ -11,6 +11,8 @@ namespace cm3cpp { +#ifndef CM3CPP_CUSTOM_INTERRUPT_SERVICE + struct EmptyInterrupt : public IInterruptable { void call() {} @@ -223,4 +225,6 @@ DEFINE_CALLBACK(dma2d_isr, ISR_DMA2D) END_DECLS +#endif // CM3CPP_CUSTOM_INTERRUPT_SERVICE + } // namespace cm3cpp diff --git a/cm3cpp/irq/irq.hpp b/cm3cpp/irq/irq.hpp index 1f09bdf..69b6fd4 100644 --- a/cm3cpp/irq/irq.hpp +++ b/cm3cpp/irq/irq.hpp @@ -193,6 +193,7 @@ enum Interrupt : uint32_t }; #endif +#ifndef CM3CPP_CUSTOM_INTERRUPT_SERVICE class IInterruptable { public: @@ -203,5 +204,6 @@ class IInterruptable IInterruptable* interrupt_owner); virtual void call() = 0; }; +#endif } /* namespace cm3cpp */ -- cgit v1.2.3 From f580d0bb402b7f3c8475e243763adfb2f4c57dc9 Mon Sep 17 00:00:00 2001 From: Lisin Dmitriy Date: Fri, 7 Jun 2019 17:41:23 +0300 Subject: IMPR: [spi] Remove unnecessary irq dependency --- cm3cpp/spi.cpp | 4 ---- cm3cpp/spi.hpp | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/cm3cpp/spi.cpp b/cm3cpp/spi.cpp index e37c256..94d775c 100644 --- a/cm3cpp/spi.cpp +++ b/cm3cpp/spi.cpp @@ -49,8 +49,6 @@ Spi::Spi(Config spi_conf) break; } - this->register_isr(_irq, this); - Gpio mosi(spi_conf.mosi_pin); mosi.mode_setup(Gpio::Mode::ALTERNATE_FUNCTION, Gpio::PullMode::NO_PULL); mosi.set_output_options(Gpio::OutputType::PUSH_PULL, @@ -182,8 +180,6 @@ inline void Spi::enable_nvic() nvic_enable_irq(static_cast(_irq)); } -void Spi::call() {} - } // namespace spi } // namespace cm3cpp diff --git a/cm3cpp/spi.hpp b/cm3cpp/spi.hpp index cbb4f13..f217d9b 100644 --- a/cm3cpp/spi.hpp +++ b/cm3cpp/spi.hpp @@ -114,7 +114,7 @@ enum StdMode MODE_3 }; -class Spi : public IInterruptable +class Spi { public: using Gpio = gpio::Gpio; @@ -130,8 +130,6 @@ class Spi : public IInterruptable Spi(); Spi(Config spi_conf); - void call(); - bool get_flag_status(Flag flag) const; void reset() { spi_reset(_spi); } -- cgit v1.2.3