Renamed to lowercase

This commit is contained in:
BlackMark 2016-05-24 19:41:59 +02:00
parent 2cf8cbb8d6
commit 89c0e2ca40
2 changed files with 44 additions and 44 deletions

View File

@ -1,17 +1,17 @@
#include "InOut.h" #include "inout.h"
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
volatile uint8_t* InOut::getPort( Pin enmPin, Type enmType ) volatile uint8_t* InOut::getPort( Pin enmPin, Type enmType )
{ {
volatile uint8_t *vpui8Port = nullptr; volatile uint8_t *vpui8Port = nullptr;
if( enmPin == Pin::P_NONE ) if( enmPin == Pin::P_NONE )
{ {
return vpui8Port; return vpui8Port;
} }
uint8_t ui8Port = ( static_cast<uint16_t>( enmPin ) >> 4 ) & 0x0F; uint8_t ui8Port = ( static_cast<uint16_t>( enmPin ) >> 4 ) & 0x0F;
switch( ui8Port ) switch( ui8Port )
{ {
case 0: case 0:
@ -99,13 +99,13 @@ void InOut::setPinDirection( Pin enmPin, Dir enmDir, bool bPullup )
{ {
return; return;
} }
volatile uint8_t *vpui8PortDir = getPort( enmPin, Type::T_DDR ); volatile uint8_t *vpui8PortDir = getPort( enmPin, Type::T_DDR );
volatile uint8_t *vpui8PortOut = getPort( enmPin, Type::T_PORT ); volatile uint8_t *vpui8PortOut = getPort( enmPin, Type::T_PORT );
uint8_t ui8Pin = getPin( enmPin ); uint8_t ui8Pin = getPin( enmPin );
setPinDirection( vpui8PortDir, ui8Pin, enmDir ); setPinDirection( vpui8PortDir, ui8Pin, enmDir );
if( enmDir == Dir::D_IN ) if( enmDir == Dir::D_IN )
{ {
writePin( vpui8PortOut, ui8Pin, bPullup ); writePin( vpui8PortOut, ui8Pin, bPullup );
@ -119,10 +119,10 @@ bool InOut::readPin( Pin enmPin )
{ {
return false; return false;
} }
volatile uint8_t *vpui8Port = getPort( enmPin, Type::T_PIN ); volatile uint8_t *vpui8Port = getPort( enmPin, Type::T_PIN );
uint8_t ui8Pin = getPin( enmPin ); uint8_t ui8Pin = getPin( enmPin );
return readPin( vpui8Port, ui8Pin ); return readPin( vpui8Port, ui8Pin );
} }
@ -133,7 +133,7 @@ void InOut::writePin( Pin enmPin, bool bValue )
{ {
return; return;
} }
volatile uint8_t *vpui8Port = getPort( enmPin, Type::T_PORT ); volatile uint8_t *vpui8Port = getPort( enmPin, Type::T_PORT );
uint8_t ui8Pin = getPin( enmPin ); uint8_t ui8Pin = getPin( enmPin );
@ -147,9 +147,9 @@ uint8_t InOut::readPort( Pin enmPortPin )
{ {
return 0; return 0;
} }
volatile uint8_t *vpui8Port = getPort( enmPortPin, Type::T_PIN ); volatile uint8_t *vpui8Port = getPort( enmPortPin, Type::T_PIN );
return readPort( vpui8Port ); return readPort( vpui8Port );
} }
@ -160,7 +160,7 @@ void InOut::writePort( Pin enmPortPin, uint8_t ui8Value )
{ {
return; return;
} }
volatile uint8_t *vpui8Port = getPort( enmPortPin, Type::T_PORT ); volatile uint8_t *vpui8Port = getPort( enmPortPin, Type::T_PORT );
writePort( vpui8Port, ui8Value ); writePort( vpui8Port, ui8Value );
@ -190,7 +190,7 @@ void InOutPin::setPin( InOut::Pin enmPin )
m_vpui8Input = InOut::getPort( enmPin, InOut::Type::T_PIN ); m_vpui8Input = InOut::getPort( enmPin, InOut::Type::T_PIN );
m_vpui8Dir = InOut::getPort( enmPin, InOut::Type::T_DDR ); m_vpui8Dir = InOut::getPort( enmPin, InOut::Type::T_DDR );
m_vpui8Output = InOut::getPort( enmPin, InOut::Type::T_PORT ); m_vpui8Output = InOut::getPort( enmPin, InOut::Type::T_PORT );
m_ui8Pin = InOut::getPin( enmPin ); m_ui8Pin = InOut::getPin( enmPin );
} }
@ -218,4 +218,4 @@ void InOutPort::setPort( InOut::Pin enmPortPin )
m_vpui8Input = InOut::getPort( enmPortPin, InOut::Type::T_PIN ); m_vpui8Input = InOut::getPort( enmPortPin, InOut::Type::T_PIN );
m_vpui8Dir = InOut::getPort( enmPortPin, InOut::Type::T_DDR ); m_vpui8Dir = InOut::getPort( enmPortPin, InOut::Type::T_DDR );
m_vpui8Output = InOut::getPort( enmPortPin, InOut::Type::T_PORT ); m_vpui8Output = InOut::getPort( enmPortPin, InOut::Type::T_PORT );
} }

View File

@ -116,17 +116,17 @@ public:
T_DDR = 1, T_DDR = 1,
T_PORT = 2 T_PORT = 2
}; };
static volatile uint8_t* getPort( Pin enmPin, Type enmType ); static volatile uint8_t* getPort( Pin enmPin, Type enmType );
static uint8_t getPin( Pin enmPin ); static uint8_t getPin( Pin enmPin );
static void setPinDirection( Pin enmPin, Dir enmDir, bool bPullup ); static void setPinDirection( Pin enmPin, Dir enmDir, bool bPullup );
static bool readPin( Pin enmPin ); static bool readPin( Pin enmPin );
static void writePin( Pin enmPin, bool bValue ); static void writePin( Pin enmPin, bool bValue );
static uint8_t readPort( Pin enmPortPin ); static uint8_t readPort( Pin enmPortPin );
static void writePort( Pin enmPortPin, uint8_t ui8Value ); static void writePort( Pin enmPortPin, uint8_t ui8Value );
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static inline void setPinDirection( volatile uint8_t *vpui8Port, uint8_t ui8Pin, Dir enmDir ) static inline void setPinDirection( volatile uint8_t *vpui8Port, uint8_t ui8Pin, Dir enmDir )
{ {
@ -139,7 +139,7 @@ public:
*vpui8Port &= ~( 1 << ui8Pin ); *vpui8Port &= ~( 1 << ui8Pin );
} }
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static inline bool readPin( volatile uint8_t *vpui8Port, uint8_t ui8Pin ) static inline bool readPin( volatile uint8_t *vpui8Port, uint8_t ui8Pin )
{ {
@ -147,10 +147,10 @@ public:
{ {
return true; return true;
} }
return false; return false;
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static inline void writePin( volatile uint8_t *vpui8Port, uint8_t ui8Pin, bool bValue ) static inline void writePin( volatile uint8_t *vpui8Port, uint8_t ui8Pin, bool bValue )
{ {
@ -163,19 +163,19 @@ public:
*vpui8Port &= ~( 1 << ui8Pin ); *vpui8Port &= ~( 1 << ui8Pin );
} }
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static inline void setPortDirection( volatile uint8_t *vpui8Port, Dir enmDir ) static inline void setPortDirection( volatile uint8_t *vpui8Port, Dir enmDir )
{ {
*vpui8Port = ( ( enmDir == InOut::Dir::D_OUT ) ? ( 0xFF ) : ( 0x00 ) ); *vpui8Port = ( ( enmDir == InOut::Dir::D_OUT ) ? ( 0xFF ) : ( 0x00 ) );
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static inline uint8_t readPort( volatile uint8_t *vpui8Port ) static inline uint8_t readPort( volatile uint8_t *vpui8Port )
{ {
return *vpui8Port; return *vpui8Port;
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
static inline void writePort( volatile uint8_t *vpui8Port, uint8_t ui8Value ) static inline void writePort( volatile uint8_t *vpui8Port, uint8_t ui8Value )
{ {
@ -191,16 +191,16 @@ private:
volatile uint8_t *m_vpui8Input; volatile uint8_t *m_vpui8Input;
volatile uint8_t *m_vpui8Dir; volatile uint8_t *m_vpui8Dir;
volatile uint8_t *m_vpui8Output; volatile uint8_t *m_vpui8Output;
uint8_t m_ui8Pin; uint8_t m_ui8Pin;
public: public:
InOutPin(); InOutPin();
InOutPin( InOut::Pin enmPin ); InOutPin( InOut::Pin enmPin );
~InOutPin(); ~InOutPin();
void setPin( InOut::Pin enmPin ); void setPin( InOut::Pin enmPin );
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
inline void setDirection( InOut::Dir enmDir, bool bPullup ) inline void setDirection( InOut::Dir enmDir, bool bPullup )
{ {
@ -208,15 +208,15 @@ public:
{ {
return; return;
} }
InOut::setPinDirection( m_vpui8Dir, m_ui8Pin, enmDir ); InOut::setPinDirection( m_vpui8Dir, m_ui8Pin, enmDir );
if( enmDir == InOut::Dir::D_IN ) if( enmDir == InOut::Dir::D_IN )
{ {
InOut::writePin( m_vpui8Output, m_ui8Pin, bPullup ); InOut::writePin( m_vpui8Output, m_ui8Pin, bPullup );
} }
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
inline bool read() inline bool read()
{ {
@ -224,10 +224,10 @@ public:
{ {
return false; return false;
} }
return InOut::readPin( m_vpui8Input, m_ui8Pin ); return InOut::readPin( m_vpui8Input, m_ui8Pin );
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
inline void write( bool bValue ) inline void write( bool bValue )
{ {
@ -235,7 +235,7 @@ public:
{ {
return; return;
} }
InOut::writePin( m_vpui8Output, m_ui8Pin, bValue ); InOut::writePin( m_vpui8Output, m_ui8Pin, bValue );
} }
}; };
@ -253,9 +253,9 @@ public:
InOutPort(); InOutPort();
InOutPort( InOut::Pin enmPortPin ); InOutPort( InOut::Pin enmPortPin );
~InOutPort(); ~InOutPort();
void setPort( InOut::Pin enmPortPin ); void setPort( InOut::Pin enmPortPin );
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
inline void setDirection( InOut::Dir enmDir, bool bPullup ) inline void setDirection( InOut::Dir enmDir, bool bPullup )
{ {
@ -263,15 +263,15 @@ public:
{ {
return; return;
} }
InOut::setPortDirection( m_vpui8Dir, enmDir ); InOut::setPortDirection( m_vpui8Dir, enmDir );
if( enmDir == InOut::Dir::D_IN ) if( enmDir == InOut::Dir::D_IN )
{ {
InOut::writePort( m_vpui8Output, ( ( bPullup ) ? ( 0xFF ) : ( 0x00 ) ) ); InOut::writePort( m_vpui8Output, ( ( bPullup ) ? ( 0xFF ) : ( 0x00 ) ) );
} }
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
inline uint8_t read() inline uint8_t read()
{ {
@ -279,10 +279,10 @@ public:
{ {
return 0; return 0;
} }
return InOut::readPort( m_vpui8Input ); return InOut::readPort( m_vpui8Input );
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
inline void write( uint8_t ui8Value ) inline void write( uint8_t ui8Value )
{ {
@ -290,9 +290,9 @@ public:
{ {
return; return;
} }
InOut::writePort( m_vpui8Output, ui8Value ); InOut::writePort( m_vpui8Output, ui8Value );
} }
}; };
#endif #endif