diff --git a/inout.h b/inout.h index dba5f59..74b17cf 100644 --- a/inout.h +++ b/inout.h @@ -1,7 +1,7 @@ /* -* Copyright (c) by BlackMark 2015-2018 -* Date 26/04/2018 -* Version 3.0 +* Copyright (c) by BlackMark 2015-2019 +* Date 02/01/2019 +* Version 3.1 */ #ifndef INOUT_H @@ -207,6 +207,7 @@ public: static inline bool read() __attribute__( (always_inline) ); static inline void write( bool bValue ) __attribute__( (always_inline) ); + static inline void toggle() __attribute__( (always_inline) ); }; ////////////////////////////////////////////////////////////////////////// @@ -255,6 +256,16 @@ inline void InOutPin::write( bool bValue ) *vpui8PORT &= ~( 1 << ui8Pin ); } +////////////////////////////////////////////////////////////////////////// +template +inline void InOutPin::toggle() +{ + constexpr volatile uint8_t *vpui8PORT = InOut::getPort( enmPin, InOut::Type::PORT ); + constexpr uint8_t ui8Pin = InOut::getPin( enmPin ); + + *vpui8PORT ^= ( 1 << ui8Pin ); +} + /************************************************************************/ //////////////////////////////////////////////////////////////////////////