Renamed project to lowercase

This commit is contained in:
BlackMark 2016-05-24 19:40:08 +02:00
parent 6b44b1868c
commit 065f21440c
8 changed files with 62 additions and 56 deletions

1
.gitattributes vendored
View File

@ -2,6 +2,7 @@
*.hpp eol=lf *.hpp eol=lf
*.c eol=lf *.c eol=lf
*.cpp eol=lf *.cpp eol=lf
.git* eol=lf
*.vcxproj* eol=crlf *.vcxproj* eol=crlf
*.cppproj eol=crlf *.cppproj eol=crlf
*.sln eol=crlf *.sln eol=crlf

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.vs
Release
Debug
*.componentinfo.xml
avrdude.bat

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00 # Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0 VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "InOut", "InOut\InOut.cppproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" Project("{E66E83B9-2572-4076-B26E-6BE79FF3018A}") = "inout", "inout\inout.cppproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

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

@ -12,9 +12,9 @@
<OutputFileName>$(MSBuildProjectName)</OutputFileName> <OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension> <OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory> <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>InOut</AssemblyName> <AssemblyName>inout</AssemblyName>
<Name>InOut</Name> <Name>inout</Name>
<RootNamespace>InOut</RootNamespace> <RootNamespace>inout</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour> <ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning> <KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor> <OverrideVtor>false</OverrideVtor>
@ -170,10 +170,10 @@
<Compile Include="Clock.h"> <Compile Include="Clock.h">
<SubType>compile</SubType> <SubType>compile</SubType>
</Compile> </Compile>
<Compile Include="InOut.cpp"> <Compile Include="inout.cpp">
<SubType>compile</SubType> <SubType>compile</SubType>
</Compile> </Compile>
<Compile Include="InOut.h"> <Compile Include="inout.h">
<SubType>compile</SubType> <SubType>compile</SubType>
</Compile> </Compile>
<Compile Include="main.cpp"> <Compile Include="main.cpp">
@ -181,4 +181,4 @@
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" /> <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project> </Project>

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

View File

@ -4,13 +4,13 @@
* Version 1.3 * Version 1.3
*/ */
#include "Clock.h" #include "clock.h"
#include "InOut.h" #include "inout.h"
int main() int main()
{ {
InOutPin cLED( InOut::Pin::P_D7 ); InOutPin cLED( InOut::Pin::P_D7 );
cLED.setDirection( InOut::Dir::D_OUT, false ); cLED.setDirection( InOut::Dir::D_OUT, false );
cLED.write( false ); cLED.write( false );
@ -47,6 +47,6 @@ int main()
_delay_ms( 1000 ); _delay_ms( 1000 );
} }
return 0; return 0;
} }