switch from using pointers to direct access.
This commit is contained in:
@@ -4,10 +4,11 @@
|
|||||||
|
|
||||||
SimpleSerialAnalyzer::SimpleSerialAnalyzer()
|
SimpleSerialAnalyzer::SimpleSerialAnalyzer()
|
||||||
: Analyzer2(),
|
: Analyzer2(),
|
||||||
mSettings( new SimpleSerialAnalyzerSettings() ),
|
mSettings(),
|
||||||
|
mResults(this, &mSettings),
|
||||||
mSimulationInitilized( false )
|
mSimulationInitilized( false )
|
||||||
{
|
{
|
||||||
SetAnalyzerSettings( mSettings.get() );
|
SetAnalyzerSettings( &mSettings );
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleSerialAnalyzer::~SimpleSerialAnalyzer()
|
SimpleSerialAnalyzer::~SimpleSerialAnalyzer()
|
||||||
@@ -17,22 +18,23 @@ SimpleSerialAnalyzer::~SimpleSerialAnalyzer()
|
|||||||
|
|
||||||
void SimpleSerialAnalyzer::SetupResults()
|
void SimpleSerialAnalyzer::SetupResults()
|
||||||
{
|
{
|
||||||
mResults.reset( new SimpleSerialAnalyzerResults( this, mSettings.get() ) );
|
// SetupResults is called each time the analyzer is run. Because the same instance can be used for multiple runs, we need to clear the results each time.
|
||||||
SetAnalyzerResults( mResults.get() );
|
mResults = SimpleSerialAnalyzerResults( this, &mSettings );
|
||||||
mResults->AddChannelBubblesWillAppearOn( mSettings->mInputChannel );
|
SetAnalyzerResults( &mResults );
|
||||||
|
mResults.AddChannelBubblesWillAppearOn( mSettings.mInputChannel );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzer::WorkerThread()
|
void SimpleSerialAnalyzer::WorkerThread()
|
||||||
{
|
{
|
||||||
mSampleRateHz = GetSampleRate();
|
mSampleRateHz = GetSampleRate();
|
||||||
|
|
||||||
mSerial = GetAnalyzerChannelData( mSettings->mInputChannel );
|
mSerial = GetAnalyzerChannelData( mSettings.mInputChannel );
|
||||||
|
|
||||||
if( mSerial->GetBitState() == BIT_LOW )
|
if( mSerial->GetBitState() == BIT_LOW )
|
||||||
mSerial->AdvanceToNextEdge();
|
mSerial->AdvanceToNextEdge();
|
||||||
|
|
||||||
U32 samples_per_bit = mSampleRateHz / mSettings->mBitRate;
|
U32 samples_per_bit = mSampleRateHz / mSettings.mBitRate;
|
||||||
U32 samples_to_first_center_of_first_data_bit = U32( 1.5 * double( mSampleRateHz ) / double( mSettings->mBitRate ) );
|
U32 samples_to_first_center_of_first_data_bit = U32( 1.5 * double( mSampleRateHz ) / double( mSettings.mBitRate ) );
|
||||||
|
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
@@ -48,7 +50,7 @@ void SimpleSerialAnalyzer::WorkerThread()
|
|||||||
for( U32 i=0; i<8; i++ )
|
for( U32 i=0; i<8; i++ )
|
||||||
{
|
{
|
||||||
//let's put a dot exactly where we sample this bit:
|
//let's put a dot exactly where we sample this bit:
|
||||||
mResults->AddMarker( mSerial->GetSampleNumber(), AnalyzerResults::Dot, mSettings->mInputChannel );
|
mResults.AddMarker( mSerial->GetSampleNumber(), AnalyzerResults::Dot, mSettings.mInputChannel );
|
||||||
|
|
||||||
if( mSerial->GetBitState() == BIT_HIGH )
|
if( mSerial->GetBitState() == BIT_HIGH )
|
||||||
data |= mask;
|
data |= mask;
|
||||||
@@ -66,8 +68,8 @@ void SimpleSerialAnalyzer::WorkerThread()
|
|||||||
frame.mStartingSampleInclusive = starting_sample;
|
frame.mStartingSampleInclusive = starting_sample;
|
||||||
frame.mEndingSampleInclusive = mSerial->GetSampleNumber();
|
frame.mEndingSampleInclusive = mSerial->GetSampleNumber();
|
||||||
|
|
||||||
mResults->AddFrame( frame );
|
mResults.AddFrame( frame );
|
||||||
mResults->CommitResults();
|
mResults.CommitResults();
|
||||||
ReportProgress( frame.mEndingSampleInclusive );
|
ReportProgress( frame.mEndingSampleInclusive );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +83,7 @@ U32 SimpleSerialAnalyzer::GenerateSimulationData( U64 minimum_sample_index, U32
|
|||||||
{
|
{
|
||||||
if( mSimulationInitilized == false )
|
if( mSimulationInitilized == false )
|
||||||
{
|
{
|
||||||
mSimulationDataGenerator.Initialize( GetSimulationSampleRate(), mSettings.get() );
|
mSimulationDataGenerator.Initialize( GetSimulationSampleRate(), &mSettings );
|
||||||
mSimulationInitilized = true;
|
mSimulationInitilized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +92,7 @@ U32 SimpleSerialAnalyzer::GenerateSimulationData( U64 minimum_sample_index, U32
|
|||||||
|
|
||||||
U32 SimpleSerialAnalyzer::GetMinimumSampleRateHz()
|
U32 SimpleSerialAnalyzer::GetMinimumSampleRateHz()
|
||||||
{
|
{
|
||||||
return mSettings->mBitRate * 4;
|
return mSettings.mBitRate * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* SimpleSerialAnalyzer::GetAnalyzerName() const
|
const char* SimpleSerialAnalyzer::GetAnalyzerName() const
|
||||||
|
|||||||
@@ -4,20 +4,20 @@
|
|||||||
|
|
||||||
SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings()
|
SimpleSerialAnalyzerSettings::SimpleSerialAnalyzerSettings()
|
||||||
: mInputChannel( UNDEFINED_CHANNEL ),
|
: mInputChannel( UNDEFINED_CHANNEL ),
|
||||||
mBitRate( 9600 )
|
mBitRate( 9600 ),
|
||||||
|
mInputChannelInterface(),
|
||||||
|
mBitRateInterface()
|
||||||
{
|
{
|
||||||
mInputChannelInterface.reset( new AnalyzerSettingInterfaceChannel() );
|
mInputChannelInterface.SetTitleAndTooltip( "Serial", "Standard Simple Serial" );
|
||||||
mInputChannelInterface->SetTitleAndTooltip( "Serial", "Standard Simple Serial" );
|
mInputChannelInterface.SetChannel( mInputChannel );
|
||||||
mInputChannelInterface->SetChannel( mInputChannel );
|
|
||||||
|
|
||||||
mBitRateInterface.reset( new AnalyzerSettingInterfaceInteger() );
|
mBitRateInterface.SetTitleAndTooltip( "Bit Rate (Bits/S)", "Specify the bit rate in bits per second." );
|
||||||
mBitRateInterface->SetTitleAndTooltip( "Bit Rate (Bits/S)", "Specify the bit rate in bits per second." );
|
mBitRateInterface.SetMax( 6000000 );
|
||||||
mBitRateInterface->SetMax( 6000000 );
|
mBitRateInterface.SetMin( 1 );
|
||||||
mBitRateInterface->SetMin( 1 );
|
mBitRateInterface.SetInteger( mBitRate );
|
||||||
mBitRateInterface->SetInteger( mBitRate );
|
|
||||||
|
|
||||||
AddInterface( mInputChannelInterface.get() );
|
AddInterface( &mInputChannelInterface );
|
||||||
AddInterface( mBitRateInterface.get() );
|
AddInterface( &mBitRateInterface );
|
||||||
|
|
||||||
AddExportOption( 0, "Export as text/csv file" );
|
AddExportOption( 0, "Export as text/csv file" );
|
||||||
AddExportExtension( 0, "text", "txt" );
|
AddExportExtension( 0, "text", "txt" );
|
||||||
@@ -33,8 +33,8 @@ SimpleSerialAnalyzerSettings::~SimpleSerialAnalyzerSettings()
|
|||||||
|
|
||||||
bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces()
|
bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces()
|
||||||
{
|
{
|
||||||
mInputChannel = mInputChannelInterface->GetChannel();
|
mInputChannel = mInputChannelInterface.GetChannel();
|
||||||
mBitRate = mBitRateInterface->GetInteger();
|
mBitRate = mBitRateInterface.GetInteger();
|
||||||
|
|
||||||
ClearChannels();
|
ClearChannels();
|
||||||
AddChannel( mInputChannel, "Simple Serial", true );
|
AddChannel( mInputChannel, "Simple Serial", true );
|
||||||
@@ -44,8 +44,8 @@ bool SimpleSerialAnalyzerSettings::SetSettingsFromInterfaces()
|
|||||||
|
|
||||||
void SimpleSerialAnalyzerSettings::UpdateInterfacesFromSettings()
|
void SimpleSerialAnalyzerSettings::UpdateInterfacesFromSettings()
|
||||||
{
|
{
|
||||||
mInputChannelInterface->SetChannel( mInputChannel );
|
mInputChannelInterface.SetChannel( mInputChannel );
|
||||||
mBitRateInterface->SetInteger( mBitRate );
|
mBitRateInterface.SetInteger( mBitRate );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings )
|
void SimpleSerialAnalyzerSettings::LoadSettings( const char* settings )
|
||||||
|
|||||||
Reference in New Issue
Block a user