Program Listing for File irq_assert.hpp

Return to documentation for file (libspookyaction/include/pn532/esp32/irq_assert.hpp)

//
// Created by spak on 3/14/21.
//

#ifndef PN532_ESP32_IRQ_ASSERT_HPP
#define PN532_ESP32_IRQ_ASSERT_HPP

#include <driver/gpio.h>
#include <memory>
#include <mlab/time.hpp>

namespace pn532::esp32 {
    class irq_assert {
        struct impl;
        std::unique_ptr<impl> _pimpl;

    public:
        irq_assert();

        irq_assert(irq_assert &&) noexcept;
        irq_assert &operator=(irq_assert &&) noexcept;

        irq_assert(irq_assert const &) noexcept = delete;
        irq_assert &operator=(irq_assert const &) noexcept = delete;
        explicit irq_assert(bool manage_isr_service, gpio_num_t pin, gpio_int_type_t interrupt_type = GPIO_INTR_NEGEDGE);

        [[nodiscard]] gpio_num_t pin() const;

        bool operator()(mlab::ms timeout);

        ~irq_assert();
    };

}// namespace pn532::esp32

#endif//PN532_ESP32_IRQ_ASSERT_HPP