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