Skip to content

Commit

Permalink
Merge pull request #8 from saleae/remove-address-display
Browse files Browse the repository at this point in the history
  • Loading branch information
Rani authored Aug 7, 2020
2 parents 76086e9 + 582cfb8 commit 103c815
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 54 deletions.
39 changes: 3 additions & 36 deletions src/I2cAnalyzerResults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,7 @@ void I2cAnalyzerResults::GenerateBubbleText( U64 frame_index, Channel& /*channel
if( frame.mType == I2cAddress )
{
char number_str[ 128 ];
switch( mSettings->mAddressDisplay )
{
case NO_DIRECTION_7:
AnalyzerHelpers::GetNumberString( frame.mData1 >> 1, display_base, 7, number_str, 128 );
break;
case NO_DIRECTION_8:
AnalyzerHelpers::GetNumberString( frame.mData1 & 0xFE, display_base, 8, number_str, 128 );
break;
case YES_DIRECTION_8:
AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, number_str, 128 );
break;
}
AnalyzerHelpers::GetNumberString( frame.mData1 >> 1, display_base, 7, number_str, 128 );

I2cDirection direction;
if( ( frame.mData1 & 0x1 ) != 0 )
Expand Down Expand Up @@ -127,18 +116,7 @@ void I2cAnalyzerResults::GenerateExportFile( const char* file, DisplayBase displ

if( frame.mType == I2cAddress )
{
switch( mSettings->mAddressDisplay )
{
case NO_DIRECTION_7:
AnalyzerHelpers::GetNumberString( frame.mData1 >> 1, display_base, 7, address, 128 );
break;
case NO_DIRECTION_8:
AnalyzerHelpers::GetNumberString( frame.mData1 & 0xFE, display_base, 8, address, 128 );
break;
case YES_DIRECTION_8:
AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, address, 128 );
break;
}
AnalyzerHelpers::GetNumberString( frame.mData1 >> 1, display_base, 7, address, 128 );
if( ( frame.mData1 & 0x1 ) != 0 )
snprintf( rw, sizeof( rw ), "Read" );
else
Expand Down Expand Up @@ -219,18 +197,7 @@ void I2cAnalyzerResults::GenerateFrameTabularText( U64 frame_index, DisplayBase
if( frame.mType == I2cAddress )
{
char number_str[ 128 ];
switch( mSettings->mAddressDisplay )
{
case NO_DIRECTION_7:
AnalyzerHelpers::GetNumberString( frame.mData1 >> 1, display_base, 7, number_str, 128 );
break;
case NO_DIRECTION_8:
AnalyzerHelpers::GetNumberString( frame.mData1 & 0xFE, display_base, 8, number_str, 128 );
break;
case YES_DIRECTION_8:
AnalyzerHelpers::GetNumberString( frame.mData1, display_base, 8, number_str, 128 );
break;
}
AnalyzerHelpers::GetNumberString( frame.mData1 >> 1, display_base, 7, number_str, 128 );

I2cDirection direction;
if( ( frame.mData1 & 0x1 ) != 0 )
Expand Down
17 changes: 1 addition & 16 deletions src/I2cAnalyzerSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <cstring>

I2cAnalyzerSettings::I2cAnalyzerSettings()
: mSdaChannel( UNDEFINED_CHANNEL ), mSclChannel( UNDEFINED_CHANNEL ), mAddressDisplay( NO_DIRECTION_7 )
: mSdaChannel( UNDEFINED_CHANNEL ), mSclChannel( UNDEFINED_CHANNEL )
{
mSdaChannelInterface.reset( new AnalyzerSettingInterfaceChannel() );
mSdaChannelInterface->SetTitleAndTooltip( "SDA", "Serial Data Line" );
Expand All @@ -14,19 +14,8 @@ I2cAnalyzerSettings::I2cAnalyzerSettings()
mSclChannelInterface->SetTitleAndTooltip( "SCL", "Serial Clock Line" );
mSclChannelInterface->SetChannel( mSclChannel );

mAddressDisplayInterface.reset( new AnalyzerSettingInterfaceNumberList() );
mAddressDisplayInterface->SetTitleAndTooltip( "Address Display", "Specify how you would like the I2C address to be displayed." );
mAddressDisplayInterface->AddNumber(
YES_DIRECTION_8, "8-bit, read/write bit included",
"Displays the address as it would be seen in a microcontroller register (with the read/write bit included)" );
mAddressDisplayInterface->AddNumber( NO_DIRECTION_8, "8-bit, read/write bit set as 0",
"Displays the I2C address as an 8 bit number, but uses 0 in place of the read/write bit" );
mAddressDisplayInterface->AddNumber( NO_DIRECTION_7, "7-bit, address bits only", "Displays the I2C address as a 7-bit number" );
mAddressDisplayInterface->SetNumber( mAddressDisplay );

AddInterface( mSdaChannelInterface.get() );
AddInterface( mSclChannelInterface.get() );
AddInterface( mAddressDisplayInterface.get() );

// AddExportOption( 0, "Export as text/csv file", "text (*.txt);;csv (*.csv)" );
AddExportOption( 0, "Export as text/csv file" );
Expand All @@ -52,7 +41,6 @@ bool I2cAnalyzerSettings::SetSettingsFromInterfaces()

mSdaChannel = mSdaChannelInterface->GetChannel();
mSclChannel = mSclChannelInterface->GetChannel();
mAddressDisplay = AddressDisplay( U32( mAddressDisplayInterface->GetNumber() ) );

ClearChannels();
AddChannel( mSdaChannel, "SDA", true );
Expand All @@ -73,7 +61,6 @@ void I2cAnalyzerSettings::LoadSettings( const char* settings )

text_archive >> mSdaChannel;
text_archive >> mSclChannel;
text_archive >> *( U32* )&mAddressDisplay;

ClearChannels();
AddChannel( mSdaChannel, "SDA", true );
Expand All @@ -89,7 +76,6 @@ const char* I2cAnalyzerSettings::SaveSettings()
text_archive << "SaleaeI2CAnalyzer";
text_archive << mSdaChannel;
text_archive << mSclChannel;
text_archive << mAddressDisplay;

return SetReturnString( text_archive.GetString() );
}
Expand All @@ -98,5 +84,4 @@ void I2cAnalyzerSettings::UpdateInterfacesFromSettings()
{
mSdaChannelInterface->SetChannel( mSdaChannel );
mSclChannelInterface->SetChannel( mSclChannel );
mAddressDisplayInterface->SetNumber( mAddressDisplay );
}
2 changes: 0 additions & 2 deletions src/I2cAnalyzerSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ class I2cAnalyzerSettings : public AnalyzerSettings

Channel mSdaChannel;
Channel mSclChannel;
enum AddressDisplay mAddressDisplay;

protected:
std::auto_ptr<AnalyzerSettingInterfaceChannel> mSdaChannelInterface;
std::auto_ptr<AnalyzerSettingInterfaceChannel> mSclChannelInterface;
std::auto_ptr<AnalyzerSettingInterfaceNumberList> mAddressDisplayInterface;
};

#endif // I2C_ANALYZER_SETTINGS

0 comments on commit 103c815

Please sign in to comment.