Removed initialization from constructor to avoid resetting USART0 when constructing USART1 and replaced dynamic vector with static convert buffer
This commit is contained in:
parent
11ba283d0e
commit
ef5599cedd
@ -180,11 +180,7 @@ void USART0::setMode( Mode enmMode )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
USART0::USART0() : USART0( 9600, 8, Parity::DISABLED, StopBit::ONE, Mode::ASYNCHRONOUS )
|
USART0::USART0()
|
||||||
{}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
USART0::USART0( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode /* = Mode::ASYNCHRONOUS */ )
|
|
||||||
{
|
{
|
||||||
#ifdef USART_SHAREDIO
|
#ifdef USART_SHAREDIO
|
||||||
m_vui8pUCSRA = &UCSRA;
|
m_vui8pUCSRA = &UCSRA;
|
||||||
@ -203,8 +199,6 @@ USART0::USART0( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, St
|
|||||||
m_vui8pUBRRL = &UBRR0L;
|
m_vui8pUBRRL = &UBRR0L;
|
||||||
m_vui8pUDR = &UDR0;
|
m_vui8pUDR = &UDR0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
init( ui32BaudRate, ui8DataBits, enmParity, enmStopBits, enmMode );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -212,7 +206,7 @@ USART0::~USART0()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::init( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode /* = Mode::ASYNCHRONOUS */ )
|
void USART0::init( uint32_t ui32BaudRate /* = 9600 */, uint8_t ui8DataBits /* = 8 */, Parity enmParity /* = Parity::DISABLED */, StopBit enmStopBits /* = StopBit::ONE */, Mode enmMode /* = Mode::ASYNCHRONOUS */ )
|
||||||
{
|
{
|
||||||
setBaudRate( ui32BaudRate );
|
setBaudRate( ui32BaudRate );
|
||||||
setDataBits( ui8DataBits );
|
setDataBits( ui8DataBits );
|
||||||
@ -425,107 +419,91 @@ void USART0::transmit( char chData )
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( unsigned char uchData )
|
void USART0::transmit( unsigned char uchData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 4 );
|
sprintf( m_szConvertBuffer, "%hhu", uchData );
|
||||||
sprintf( vecBuffer.data(), "%hhu", uchData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( short int shiData )
|
void USART0::transmit( short int shiData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 6 );
|
sprintf( m_szConvertBuffer, "%hd", shiData );
|
||||||
sprintf( vecBuffer.data(), "%hd", shiData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( unsigned short int ushiData )
|
void USART0::transmit( unsigned short int ushiData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 6 );
|
sprintf( m_szConvertBuffer, "%hu", ushiData );
|
||||||
sprintf( vecBuffer.data(), "%hu", ushiData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( int iData )
|
void USART0::transmit( int iData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 6 );
|
sprintf( m_szConvertBuffer, "%d", iData );
|
||||||
sprintf( vecBuffer.data(), "%d", iData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( unsigned int uiData )
|
void USART0::transmit( unsigned int uiData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 6 );
|
sprintf( m_szConvertBuffer, "%u", uiData );
|
||||||
sprintf( vecBuffer.data(), "%u", uiData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( long int liData )
|
void USART0::transmit( long int liData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 11 );
|
sprintf( m_szConvertBuffer, "%ld", liData );
|
||||||
sprintf( vecBuffer.data(), "%ld", liData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( unsigned long int uliData )
|
void USART0::transmit( unsigned long int uliData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 11 );
|
sprintf( m_szConvertBuffer, "%lu", uliData );
|
||||||
sprintf( vecBuffer.data(), "%lu", uliData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( long long int lliData )
|
void USART0::transmit( long long int lliData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 21 );
|
sprintf( m_szConvertBuffer, "%lld", lliData );
|
||||||
sprintf( vecBuffer.data(), "%lld", lliData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( unsigned long long int ulliData )
|
void USART0::transmit( unsigned long long int ulliData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 21 );
|
sprintf( m_szConvertBuffer, "%llu", ulliData );
|
||||||
sprintf( vecBuffer.data(), "%llu", ulliData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( float fData )
|
void USART0::transmit( float fData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 64 );
|
sprintf( m_szConvertBuffer, "%f", static_cast<double>( fData ) );
|
||||||
sprintf( vecBuffer.data(), "%f", static_cast<double>( fData ) );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( double dData )
|
void USART0::transmit( double dData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 64 );
|
sprintf( m_szConvertBuffer, "%f", dData );
|
||||||
sprintf( vecBuffer.data(), "%f", dData );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void USART0::transmit( long double ldData )
|
void USART0::transmit( long double ldData )
|
||||||
{
|
{
|
||||||
vector<char> vecBuffer( 64 );
|
sprintf( m_szConvertBuffer, "%f", static_cast<double>( ldData ) );
|
||||||
sprintf( vecBuffer.data(), "%f", static_cast<double>( ldData ) );
|
transmit( m_szConvertBuffer );
|
||||||
transmit( vecBuffer.data() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SECOND_USART
|
#ifdef SECOND_USART
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
USART1::USART1() : USART1( 9600, 8, Parity::DISABLED, StopBit::ONE, Mode::ASYNCHRONOUS )
|
USART1::USART1()
|
||||||
{}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
USART1::USART1( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode /* = Mode::ASYNCHRONOUS */ )
|
|
||||||
{
|
{
|
||||||
m_vui8pUCSRA = &UCSR1A;
|
m_vui8pUCSRA = &UCSR1A;
|
||||||
m_vui8pUCSRB = &UCSR1B;
|
m_vui8pUCSRB = &UCSR1B;
|
||||||
@ -533,8 +511,6 @@ USART1::USART1( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, St
|
|||||||
m_vui8pUBRRH = &UBRR1H;
|
m_vui8pUBRRH = &UBRR1H;
|
||||||
m_vui8pUBRRL = &UBRR1L;
|
m_vui8pUBRRL = &UBRR1L;
|
||||||
m_vui8pUDR = &UDR1;
|
m_vui8pUDR = &UDR1;
|
||||||
|
|
||||||
init( ui32BaudRate, ui8DataBits, enmParity, enmStopBits, enmMode );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -55,6 +55,18 @@
|
|||||||
</com_atmel_avrdbg_tool_stk500>
|
</com_atmel_avrdbg_tool_stk500>
|
||||||
<avrtoolinterface>ISP</avrtoolinterface>
|
<avrtoolinterface>ISP</avrtoolinterface>
|
||||||
<avrtoolinterfaceclock>1843200</avrtoolinterfaceclock>
|
<avrtoolinterfaceclock>1843200</avrtoolinterfaceclock>
|
||||||
|
<com_atmel_avrdbg_tool_simulator>
|
||||||
|
<ToolOptions xmlns="">
|
||||||
|
<InterfaceProperties>
|
||||||
|
</InterfaceProperties>
|
||||||
|
<InterfaceName>
|
||||||
|
</InterfaceName>
|
||||||
|
</ToolOptions>
|
||||||
|
<ToolType xmlns="">com.atmel.avrdbg.tool.simulator</ToolType>
|
||||||
|
<ToolNumber xmlns="">
|
||||||
|
</ToolNumber>
|
||||||
|
<ToolName xmlns="">Simulator</ToolName>
|
||||||
|
</com_atmel_avrdbg_tool_simulator>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
<ToolchainSettings>
|
<ToolchainSettings>
|
||||||
@ -68,49 +80,26 @@
|
|||||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
<avrgcc.compiler.symbols.DefSymbols>
|
<avrgcc.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcc.compiler.directories.IncludePaths>
|
||||||
<ListValues>
|
|
||||||
<Value>NDEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
|
||||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
<avrgcccpp.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.compiler.directories.IncludePaths>
|
||||||
<ListValues>
|
|
||||||
<Value>NDEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
|
|
||||||
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
||||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||||
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||||
<avrgcccpp.linker.libraries.Libraries>
|
<avrgcccpp.linker.general.UseVprintfLibrary>True</avrgcccpp.linker.general.UseVprintfLibrary>
|
||||||
<ListValues>
|
<avrgcccpp.linker.libraries.Libraries><ListValues><Value>libm</Value><Value>libprintf_flt</Value></ListValues></avrgcccpp.linker.libraries.Libraries>
|
||||||
<Value>libm</Value>
|
<avrgcccpp.assembler.general.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.assembler.general.IncludePaths>
|
||||||
</ListValues>
|
<avrgcc.compiler.symbols.DefSymbols><ListValues><Value>NDEBUG</Value></ListValues></avrgcc.compiler.symbols.DefSymbols>
|
||||||
</avrgcccpp.linker.libraries.Libraries>
|
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||||
<avrgcccpp.assembler.general.IncludePaths>
|
<avrgcccpp.compiler.symbols.DefSymbols><ListValues><Value>NDEBUG</Value></ListValues></avrgcccpp.compiler.symbols.DefSymbols>
|
||||||
<ListValues>
|
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
|
||||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
</AvrGccCpp>
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.assembler.general.IncludePaths>
|
|
||||||
</AvrGccCpp>
|
|
||||||
</ToolchainSettings>
|
</ToolchainSettings>
|
||||||
<PreBuildEvent>echo "C:\avrdude-6.2\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat"</PreBuildEvent>
|
<PreBuildEvent>echo "C:\avrdude-6.2\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat"</PreBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -126,52 +115,29 @@
|
|||||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
<avrgcc.compiler.symbols.DefSymbols>
|
<avrgcc.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcc.compiler.directories.IncludePaths>
|
||||||
<ListValues>
|
|
||||||
<Value>DEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcc.compiler.directories.IncludePaths>
|
|
||||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
|
||||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
|
||||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
<avrgcccpp.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.compiler.directories.IncludePaths>
|
||||||
<ListValues>
|
|
||||||
<Value>DEBUG</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.symbols.DefSymbols>
|
|
||||||
<avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
|
||||||
</ListValues>
|
|
||||||
</avrgcccpp.compiler.directories.IncludePaths>
|
|
||||||
<avrgcccpp.compiler.optimization.level>Optimize (-O1)</avrgcccpp.compiler.optimization.level>
|
|
||||||
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
||||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||||
<avrgcccpp.compiler.optimization.DebugLevel>Default (-g2)</avrgcccpp.compiler.optimization.DebugLevel>
|
|
||||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||||
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||||
<avrgcccpp.linker.libraries.Libraries>
|
<avrgcccpp.linker.general.UseVprintfLibrary>True</avrgcccpp.linker.general.UseVprintfLibrary>
|
||||||
<ListValues>
|
<avrgcccpp.linker.libraries.Libraries><ListValues><Value>libm</Value><Value>libprintf_flt</Value></ListValues></avrgcccpp.linker.libraries.Libraries>
|
||||||
<Value>libm</Value>
|
<avrgcccpp.assembler.general.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.assembler.general.IncludePaths>
|
||||||
</ListValues>
|
<avrgcc.compiler.symbols.DefSymbols><ListValues><Value>DEBUG</Value></ListValues></avrgcc.compiler.symbols.DefSymbols>
|
||||||
</avrgcccpp.linker.libraries.Libraries>
|
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
||||||
<avrgcccpp.assembler.general.IncludePaths>
|
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||||
<ListValues>
|
<avrgcccpp.compiler.symbols.DefSymbols><ListValues><Value>DEBUG</Value></ListValues></avrgcccpp.compiler.symbols.DefSymbols>
|
||||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
<avrgcccpp.compiler.optimization.level>Optimize (-O1)</avrgcccpp.compiler.optimization.level>
|
||||||
</ListValues>
|
<avrgcccpp.compiler.optimization.DebugLevel>Default (-g2)</avrgcccpp.compiler.optimization.DebugLevel>
|
||||||
</avrgcccpp.assembler.general.IncludePaths>
|
|
||||||
<avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel>
|
<avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel>
|
||||||
</AvrGccCpp>
|
</AvrGccCpp>
|
||||||
</ToolchainSettings>
|
</ToolchainSettings>
|
||||||
<PreBuildEvent>echo "C:\avrdude-6.2\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat"</PreBuildEvent>
|
<PreBuildEvent>echo "C:\avrdude-6.2\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat"</PreBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) by BlackMark 2015-2016
|
* Copyright (c) by BlackMark 2015-2016
|
||||||
* Date 05/01/2016
|
* Date 19/05/2016
|
||||||
* Version 2.2
|
* Version 2.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef USART_H
|
#ifndef USART_H
|
||||||
@ -91,6 +91,7 @@ protected:
|
|||||||
volatile uint8_t *m_vui8pUDR;
|
volatile uint8_t *m_vui8pUDR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
char m_szConvertBuffer[64];
|
||||||
uint8_t readUCSRC();
|
uint8_t readUCSRC();
|
||||||
void setUCSRC( uint8_t ui8UCSRC );
|
void setUCSRC( uint8_t ui8UCSRC );
|
||||||
|
|
||||||
@ -104,10 +105,9 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
USART0();
|
USART0();
|
||||||
USART0( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode = Mode::ASYNCHRONOUS );
|
|
||||||
~USART0();
|
~USART0();
|
||||||
|
|
||||||
void init( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode = Mode::ASYNCHRONOUS );
|
void init( uint32_t ui32BaudRate = 9600, uint8_t ui8DataBits = 8, Parity enmParity = Parity::DISABLED, StopBit enmStopBits = StopBit::ONE, Mode enmMode = Mode::ASYNCHRONOUS );
|
||||||
|
|
||||||
bool receiveByte( unsigned char &chData, uint32_t ui32DelayMS );
|
bool receiveByte( unsigned char &chData, uint32_t ui32DelayMS );
|
||||||
unsigned char receiveByte();
|
unsigned char receiveByte();
|
||||||
@ -167,7 +167,6 @@ class USART1 : public USART0
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
USART1();
|
USART1();
|
||||||
USART1( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode = Mode::ASYNCHRONOUS );
|
|
||||||
~USART1();
|
~USART1();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
USART0 cUSART;
|
USART0 cUSART;
|
||||||
|
cUSART.init();
|
||||||
|
|
||||||
uint32_t ui32Counter = 0;
|
uint32_t ui32Counter = 0;
|
||||||
|
|
||||||
@ -50,6 +51,9 @@ int main()
|
|||||||
|
|
||||||
cUSART << "\r\nYou entered: " << dNumber << "\r\n\r\n";
|
cUSART << "\r\nYou entered: " << dNumber << "\r\n\r\n";
|
||||||
|
|
||||||
|
unsigned char uchByte;
|
||||||
|
cUSART.receiveByte( uchByte, 1000 );
|
||||||
|
|
||||||
_delay_ms( 1000 );
|
_delay_ms( 1000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user