#ifndef _GPIO_H_ #define _GPIO_H_ #include #include #include class Pin { public: enum mode { undefined, input, output, analog, alternate }; enum state { floating, pushPull, openDrain }; enum pullUpDown { none, pullUp, pullDown }; enum speed { slow, normal, fast, veryFast }; enum interrupt { disabled, enabled }; struct configuration { mode md; state st; pullUpDown pud; speed sp; interrupt intr; }; enum errors { notValidMode, notValidOut, OutOfRange, NotDeclared, NotReachable, NoPullUpDown, NotAnalog, NotDigital, TooFast, Bocked, AlreadyUsed, NotGpio }; Pin(); ~Pin(); void setMode(mode mode); void setOutputState(state state); void setPullUpDonw(pullUpDown resistance); void setSpeed(speed speed); void config(mode mode, state state, pullUpDown resistance, speed speed); bool read(); bool toggle(); void write(bool state); void init(); void deInit(); void hardwareInfo(); private: void throwError(uint16_t line, errors errNo); }; #endif // _GPIO_H_