device: add a verbose parameter

This commit is contained in:
Gwenhael Goavec-Merou 2019-11-21 08:38:11 +01:00
parent 32fc458eff
commit f5791ca0d4
2 changed files with 6 additions and 4 deletions

View File

@ -5,13 +5,14 @@
using namespace std; using namespace std;
Device::Device(FtdiJtag *jtag, string filename): Device::Device(FtdiJtag *jtag, string filename, bool verbose):
_filename(filename), _filename(filename),
_file_extension(filename.substr(filename.find_last_of(".") +1)), _file_extension(filename.substr(filename.find_last_of(".") +1)),
_mode(NONE_MODE) _mode(NONE_MODE), _verbose(verbose)
{ {
_jtag = jtag; _jtag = jtag;
cout << _file_extension << endl; if (_verbose)
cout << "File type : " << _file_extension << endl;
} }
Device::~Device() {} Device::~Device() {}

View File

@ -18,7 +18,7 @@ class Device {
FLASH_MODE = 1, FLASH_MODE = 1,
MEM_MODE = 2 MEM_MODE = 2
}; };
Device(FtdiJtag *jtag, std::string filename); Device(FtdiJtag *jtag, std::string filename, bool verbose = false);
virtual ~Device(); virtual ~Device();
virtual void program(unsigned int offset = 0) = 0; virtual void program(unsigned int offset = 0) = 0;
virtual int idCode() = 0; virtual int idCode() = 0;
@ -28,6 +28,7 @@ class Device {
std::string _filename; std::string _filename;
std::string _file_extension; std::string _file_extension;
enum prog_mode _mode; enum prog_mode _mode;
bool _verbose;
}; };
#endif #endif