/* * File: pin.hpp * Author: naopross * * Created on May 3, 2018, 8:02 PM */ #ifndef PIN_HPP #define PIN_HPP extern "C" { #include } template class pin { public: enum class mode : unsigned { INPUT = 1, OUTPUT = 0 }; enum class state : unsigned { ON = 1, OFF = 0 }; pin() = delete; template pin(latch_T *latch, tris_T *tris, port_T *port); virtual ~pin(); void set_mode(unsigned m); void set_mode(mode m); state read() const; void set(unsigned s); void set(state s); void toggle(); bool operator==(const pin &other) const; bool operator!=(const pin &other) const; private: volatile uint8_t *_latch; volatile uint8_t *_tris; volatile uint8_t *_port; }; #endif /* PIN_HPP */