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( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode /* = Mode::ASYNCHRONOUS */ )
|
||||
USART0::USART0()
|
||||
{
|
||||
#ifdef USART_SHAREDIO
|
||||
m_vui8pUCSRA = &UCSRA;
|
||||
@ -203,8 +199,6 @@ USART0::USART0( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, St
|
||||
m_vui8pUBRRL = &UBRR0L;
|
||||
m_vui8pUDR = &UDR0;
|
||||
#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 );
|
||||
setDataBits( ui8DataBits );
|
||||
@ -425,107 +419,91 @@ void USART0::transmit( char chData )
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( unsigned char uchData )
|
||||
{
|
||||
vector<char> vecBuffer( 4 );
|
||||
sprintf( vecBuffer.data(), "%hhu", uchData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%hhu", uchData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( short int shiData )
|
||||
{
|
||||
vector<char> vecBuffer( 6 );
|
||||
sprintf( vecBuffer.data(), "%hd", shiData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%hd", shiData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( unsigned short int ushiData )
|
||||
{
|
||||
vector<char> vecBuffer( 6 );
|
||||
sprintf( vecBuffer.data(), "%hu", ushiData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%hu", ushiData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( int iData )
|
||||
{
|
||||
vector<char> vecBuffer( 6 );
|
||||
sprintf( vecBuffer.data(), "%d", iData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%d", iData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( unsigned int uiData )
|
||||
{
|
||||
vector<char> vecBuffer( 6 );
|
||||
sprintf( vecBuffer.data(), "%u", uiData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%u", uiData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( long int liData )
|
||||
{
|
||||
vector<char> vecBuffer( 11 );
|
||||
sprintf( vecBuffer.data(), "%ld", liData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%ld", liData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( unsigned long int uliData )
|
||||
{
|
||||
vector<char> vecBuffer( 11 );
|
||||
sprintf( vecBuffer.data(), "%lu", uliData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%lu", uliData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( long long int lliData )
|
||||
{
|
||||
vector<char> vecBuffer( 21 );
|
||||
sprintf( vecBuffer.data(), "%lld", lliData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%lld", lliData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( unsigned long long int ulliData )
|
||||
{
|
||||
vector<char> vecBuffer( 21 );
|
||||
sprintf( vecBuffer.data(), "%llu", ulliData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%llu", ulliData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( float fData )
|
||||
{
|
||||
vector<char> vecBuffer( 64 );
|
||||
sprintf( vecBuffer.data(), "%f", static_cast<double>( fData ) );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%f", static_cast<double>( fData ) );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( double dData )
|
||||
{
|
||||
vector<char> vecBuffer( 64 );
|
||||
sprintf( vecBuffer.data(), "%f", dData );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%f", dData );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void USART0::transmit( long double ldData )
|
||||
{
|
||||
vector<char> vecBuffer( 64 );
|
||||
sprintf( vecBuffer.data(), "%f", static_cast<double>( ldData ) );
|
||||
transmit( vecBuffer.data() );
|
||||
sprintf( m_szConvertBuffer, "%f", static_cast<double>( ldData ) );
|
||||
transmit( m_szConvertBuffer );
|
||||
}
|
||||
|
||||
#ifdef SECOND_USART
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
USART1::USART1() : USART1( 9600, 8, Parity::DISABLED, StopBit::ONE, Mode::ASYNCHRONOUS )
|
||||
{}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
USART1::USART1( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode /* = Mode::ASYNCHRONOUS */ )
|
||||
USART1::USART1()
|
||||
{
|
||||
m_vui8pUCSRA = &UCSR1A;
|
||||
m_vui8pUCSRB = &UCSR1B;
|
||||
@ -533,8 +511,6 @@ USART1::USART1( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, St
|
||||
m_vui8pUBRRH = &UBRR1H;
|
||||
m_vui8pUBRRL = &UBRR1L;
|
||||
m_vui8pUDR = &UDR1;
|
||||
|
||||
init( ui32BaudRate, ui8DataBits, enmParity, enmStopBits, enmMode );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -55,123 +55,89 @@
|
||||
</com_atmel_avrdbg_tool_stk500>
|
||||
<avrtoolinterface>ISP</avrtoolinterface>
|
||||
<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 Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGccCpp>
|
||||
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\gcc\dev\atmega328p"</avrgcc.common.Device>
|
||||
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<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.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
||||
<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.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.linker.libraries.Libraries>
|
||||
<avrgcccpp.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.assembler.general.IncludePaths>
|
||||
</AvrGccCpp>
|
||||
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\gcc\dev\atmega328p"</avrgcc.common.Device>
|
||||
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcccpp.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.compiler.directories.IncludePaths>
|
||||
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.general.UseVprintfLibrary>True</avrgcccpp.linker.general.UseVprintfLibrary>
|
||||
<avrgcccpp.linker.libraries.Libraries><ListValues><Value>libm</Value><Value>libprintf_flt</Value></ListValues></avrgcccpp.linker.libraries.Libraries>
|
||||
<avrgcccpp.assembler.general.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.assembler.general.IncludePaths>
|
||||
<avrgcc.compiler.symbols.DefSymbols><ListValues><Value>NDEBUG</Value></ListValues></avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols><ListValues><Value>NDEBUG</Value></ListValues></avrgcccpp.compiler.symbols.DefSymbols>
|
||||
<avrgcccpp.compiler.optimization.level>Optimize for size (-Os)</avrgcccpp.compiler.optimization.level>
|
||||
</AvrGccCpp>
|
||||
</ToolchainSettings>
|
||||
<PreBuildEvent>echo "C:\avrdude-6.2\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat"</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGccCpp>
|
||||
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\gcc\dev\atmega328p"</avrgcc.common.Device>
|
||||
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<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.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>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols>
|
||||
<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.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.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.linker.libraries.Libraries>
|
||||
<avrgcccpp.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value>
|
||||
</ListValues>
|
||||
</avrgcccpp.assembler.general.IncludePaths>
|
||||
<avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel>
|
||||
</AvrGccCpp>
|
||||
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\gcc\dev\atmega328p"</avrgcc.common.Device>
|
||||
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcccpp.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcccpp.compiler.directories.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.compiler.directories.IncludePaths>
|
||||
<avrgcccpp.compiler.optimization.PackStructureMembers>True</avrgcccpp.compiler.optimization.PackStructureMembers>
|
||||
<avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcccpp.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcccpp.compiler.warnings.AllWarnings>True</avrgcccpp.compiler.warnings.AllWarnings>
|
||||
<avrgcccpp.compiler.warnings.Pedantic>True</avrgcccpp.compiler.warnings.Pedantic>
|
||||
<avrgcccpp.compiler.miscellaneous.OtherFlags>-Wextra -std=c++11</avrgcccpp.compiler.miscellaneous.OtherFlags>
|
||||
<avrgcccpp.linker.general.UseVprintfLibrary>True</avrgcccpp.linker.general.UseVprintfLibrary>
|
||||
<avrgcccpp.linker.libraries.Libraries><ListValues><Value>libm</Value><Value>libprintf_flt</Value></ListValues></avrgcccpp.linker.libraries.Libraries>
|
||||
<avrgcccpp.assembler.general.IncludePaths><ListValues><Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.106\include</Value></ListValues></avrgcccpp.assembler.general.IncludePaths>
|
||||
<avrgcc.compiler.symbols.DefSymbols><ListValues><Value>DEBUG</Value></ListValues></avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcccpp.compiler.symbols.DefSymbols><ListValues><Value>DEBUG</Value></ListValues></avrgcccpp.compiler.symbols.DefSymbols>
|
||||
<avrgcccpp.compiler.optimization.level>Optimize (-O1)</avrgcccpp.compiler.optimization.level>
|
||||
<avrgcccpp.compiler.optimization.DebugLevel>Default (-g2)</avrgcccpp.compiler.optimization.DebugLevel>
|
||||
<avrgcccpp.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcccpp.assembler.debugging.DebugLevel>
|
||||
</AvrGccCpp>
|
||||
</ToolchainSettings>
|
||||
<PreBuildEvent>echo "C:\avrdude-6.2\avrdude.exe" -v -p$(avrdevice) %%* -Uflash:w:"$(OutputDirectory)\$(Name).hex":i > "$(MSBuildProjectDirectory)\avrdude.bat"</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) by BlackMark 2015-2016
|
||||
* Date 05/01/2016
|
||||
* Version 2.2
|
||||
* Date 19/05/2016
|
||||
* Version 2.3
|
||||
*/
|
||||
|
||||
#ifndef USART_H
|
||||
@ -91,6 +91,7 @@ protected:
|
||||
volatile uint8_t *m_vui8pUDR;
|
||||
|
||||
private:
|
||||
char m_szConvertBuffer[64];
|
||||
uint8_t readUCSRC();
|
||||
void setUCSRC( uint8_t ui8UCSRC );
|
||||
|
||||
@ -104,10 +105,9 @@ private:
|
||||
|
||||
public:
|
||||
USART0();
|
||||
USART0( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode = Mode::ASYNCHRONOUS );
|
||||
~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 );
|
||||
unsigned char receiveByte();
|
||||
@ -167,7 +167,6 @@ class USART1 : public USART0
|
||||
{
|
||||
public:
|
||||
USART1();
|
||||
USART1( uint32_t ui32BaudRate, uint8_t ui8DataBits, Parity enmParity, StopBit enmStopBits, Mode enmMode = Mode::ASYNCHRONOUS );
|
||||
~USART1();
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
int main()
|
||||
{
|
||||
USART0 cUSART;
|
||||
cUSART.init();
|
||||
|
||||
uint32_t ui32Counter = 0;
|
||||
|
||||
@ -50,6 +51,9 @@ int main()
|
||||
|
||||
cUSART << "\r\nYou entered: " << dNumber << "\r\n\r\n";
|
||||
|
||||
unsigned char uchByte;
|
||||
cUSART.receiveByte( uchByte, 1000 );
|
||||
|
||||
_delay_ms( 1000 );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user