Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3_cpp_extensions.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Orfanidi <i.orfanidi@mail.ru>2019-06-10 11:20:30 +0300
committerGitHub <noreply@github.com>2019-06-10 11:20:30 +0300
commit2164b06213bdb248cb04f9dd6b76b893b1ff2efb (patch)
tree78e5d3271de45acbda89a8fa2a62ef18ec2661b5
parentad9af406e25eb137e70b1792c1ed140cb2d893fd (diff)
parentf580d0bb402b7f3c8475e243763adfb2f4c57dc9 (diff)
Merge pull request #4 from thirdpin/disable_irq_service
Disable irq service
-rw-r--r--README.rst3
-rw-r--r--cm3cpp/irq/irq.cpp4
-rw-r--r--cm3cpp/irq/irq.hpp2
-rw-r--r--cm3cpp/spi.cpp4
-rw-r--r--cm3cpp/spi.hpp4
5 files changed, 10 insertions, 7 deletions
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 */
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<uint8_t>(_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); }