1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
|
//=========================================================================//
// //
// PonyProg - Serial Device Programmer //
// //
// Copyright (C) 1997-2025 Claudio Lanconelli //
// //
// https://github.com/lancos/ponyprog //
// //
//-------------------------------------------------------------------------//
// //
// This program is free software; you can redistribute it and/or //
// modify it under the terms of the GNU General Public License //
// as published by the Free Software Foundation; either version2 of //
// the License, or (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
// General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program (see LICENSE); if not, write to the //
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
// //
//=========================================================================//
#ifndef _E2PROFILE_H
#define _E2PROFILE_H
#include <QPrinter>
#include <QSettings>
#include "types.h"
#include "globals.h"
#include "interfconv.h"
#include <QString>
#include <QWidget>
#include <QSplitter>
#define CLOCKINV (1<<0)
#define RESETINV (1<<1)
#define DININV (1<<2)
#define DOUTINV (1<<3)
#define POWERINV (1<<4)
#define ENBUSINV (1<<5)
#define CLOCKININV (1<<6)
#define CTRLININV (1<<7)
#define RELOAD_idx 0
#define READFLASH_idx 1
#define READEEP_idx 2
#define BYTESWAP_idx 3
#define SETID_idx 4
#define READOSCCAL_idx 5
#define ERASE_idx 6
#define FLASH_idx 7
#define EEPROM_idx 8
#define LOCK_idx 9
#define RELOAD_YES (1<<RELOAD_idx)
#define READFLASH_YES (1<<READFLASH_idx)
#define READEEP_YES (1<<READEEP_idx)
#define BYTESWAP_YES (1<<BYTESWAP_idx)
#define SETID_YES (1<<SETID_idx)
#define ERASE_YES (1<<ERASE_idx)
#define FLASH_YES (1<<FLASH_idx)
#define EEPROM_YES (1<<EEPROM_idx)
#define LOCK_YES (1<<LOCK_idx)
#define READOSCAL_YES (1<<READOSCCAL_idx)
typedef enum
{
FMT_LITTLE_ENDIAN,
FMT_BIG_ENDIAN
} FmtEndian;
enum
{
ULTRASLOW = 0,
VERYSLOW,
SLOW,
NORMAL,
FAST,
TURBO
};
class E2Profile
{
public:
//E2Profile(const QString &nm);
//virtual ~E2Profile();
static void sync()
{
s->sync();
}
static HInterfaceType GetParInterfType();
static void SetParInterfType(HInterfaceType type);
static int GetPortNumber();
static void SetPortNumber(int value);
static int GetBogoMips();
static void SetBogoMips(int value);
static long GetLastDevType();
static void SetLastDevType(long devtype);
static QString GetLastFile(int &data, int index = 0);
static void SetLastFile(const QString &name, int data = ALL_TYPE);
static void SetLastScript(const QString &name);
static QStringList GetLastScripts();
static unsigned int GetPolarityLines();
static void SetPolarityLines(unsigned int polarity_control);
static int GetSPIPageWrite();
static void SetSPIPageWrite(int page_write = 1);
static int GetI2CPageWrite();
static void SetI2CPageWrite(int page_write = 1);
static int GetI2CBaseAddr();
static void SetI2CBaseAddr(int base_addr = 0xA0);
static int GetI2CSpeed();
static void SetI2CSpeed(int speed = NORMAL);
static int GetSPIResetPulse();
static void SetSPIResetPulse(int delay = 100);
static int GetSPIDelayAfterReset();
static void SetSPIDelayAfterReset(int delay = 50);
static int GetAT89DelayAfterReset();
static void SetAT89DelayAfterReset(int delay = 50);
static void GetPrinterSettings(QPrinter &p);
static void SetPrinterSettings(QPrinter &p);
static int GetAVRDelayAfterReset();
static void SetAVRDelayAfterReset(int delay = 50);
static int GetPowerUpDelay();
static void SetPowerUpDelay(int delay = 200);
static int GetSPISpeed();
static void SetSPISpeed(int speed = NORMAL);
static int GetMegaPageDelay();
static void SetMegaPageDelay(int delay = 25);
static int GetMicroWireSpeed();
static void SetMicroWireSpeed(int speed = NORMAL);
static int GetPICSpeed();
static void SetPICSpeed(int speed = NORMAL);
static int GetSDESpeed();
static void SetSDESpeed(int speed = NORMAL);
static int GetIMBusSpeed();
static void SetIMBusSpeed(int speed = NORMAL);
static int GetAVRProgDelay();
static void SetAVRProgDelay(int delay = 10);
static int GetFontSize();
static void SetFontSize(int sz = 9);
static QStringList GetLastFiles();
static int GetAVREraseDelay();
static void SetAVREraseDelay(int delay = 30);
static int GetMDAProgDelay();
static void SetMDAProgDelay(int delay = 30);
static int GetNVMProgDelay();
static void SetNVMProgDelay(int delay = 30);
static unsigned long GetSerialNumVal();
static void SetSerialNumVal(unsigned long val = 0);
static int GetSerialNumAddress(long &start, int &size, bool &mtype);
static void SetSerialNumAddress(unsigned long start, int size, bool mtype);
static FmtEndian GetSerialNumFormat();
static void SetSerialNumFormat(FmtEndian fmt);
static bool GetSerialNumAutoInc();
static void SetSerialNumAutoInc(bool val = true);
static long GetProgramOptions();
static void SetProgramOptions(long prog_option);
static int GetCalibrationAddress(bool &enabled, long &start, int &size, bool &mtype);
static void SetCalibrationAddress(bool enabled, unsigned long start, int size, bool mtype);
static QString GetLogFileName();
static void SetLogFileName(const QString &name);
static QString GetLangDir();
static void SetLangDir(const QString &name);
static QString GetCurrentLang();
static void SetCurrentLang(const QString &name);
static bool GetLogEnabled();
static void SetLogEnabled(bool enabled = false);
static bool GetSkipStartupDialog();
static void SetSkipStartupDialog(bool skip = false);
static bool GetClearBufBeforeLoad();
static void SetClearBufBeforeLoad(bool val = false);
static bool GetClearBufBeforeRead();
static void SetClearBufBeforeRead(bool val = false);
static bool GetAt89PageOp();
static void SetAt89PageOp(bool val = true);
static bool Get8253FallEdge();
static void Set8253FallEdge(bool falledge);
static QString GetLanguageCode();
static void SetLanguageCode(const QString &code);
static bool GetSoundEnabled();
static void SetSoundEnabled(bool val = true);
static bool GetVerifyAfterWrite();
static void SetVerifyAfterWrite(bool enabled = true);
static unsigned int GetJDMCmd2CmdDelay();
static void SetJDMCmd2CmdDelay(unsigned int delay = 4000);
static bool GetAutoDetectPorts();
static void SetAutoDetectPorts(bool enabled = true);
static int GetCOMAddress(unsigned int &com1, unsigned int &com2, unsigned int &com3, unsigned int &com4);
static void SetCOMAddress(unsigned int com1, unsigned int com2, unsigned int com3, unsigned int com4);
static int GetLPTAddress(unsigned int &lpt1, unsigned int &lpt2, unsigned int &lpt3);
static void SetLPTAddress(unsigned int lpt1, unsigned int lpt2, unsigned int lpt3);
static QString GetConfigFile()
{
return s->fileName();
}
static QString GetCOMDevName();
static void SetCOMDevName(const QString &name);
static QStringList GetCOMDevList();
static void SetCOMDevList(const QStringList &lst);
static QString GetLPTDevName();
static void SetLPTDevName(const QString &name);
static QStringList GetLPTDevList();
static void SetLPTDevList(const QStringList &lst);
static FileType GetDefaultFileType();
static void SetDefaultFileType(FileType ft);
//static QString GetHtmlBrowseApp();
//static void SetHtmlBrowseApp(const QString &name);
static int GetInterfacePort();
static void SetInterfacePort(int port_index);
static void GetInterfacePins(HInterfaceType type, InterfPins &pins);
static InterfPins GetInterfacePins(HInterfaceType type)
{
InterfPins pins;
GetInterfacePins(type, pins);
return pins;
}
static void SetInterfacePins(HInterfaceType type, const InterfPins &pins);
static bool GetEditBufferEnabled();
static void SetEditBufferEnabled(bool enable);
static void readDialogSettings(QWidget *window, bool recurse = true);
static void writeDialogSettings(QWidget *window, bool recurse = true);
static void restoreSplitter(QSplitter *spl);
static void saveSplitter(QSplitter *spl);
protected:
static void recurseRead(QObject *object);
static void recurseWrite(QObject *object);
static void SetLastFiles(const QStringList &l);
static void SetLastScripts(const QStringList &l);
static QSettings *s;
private:
static int getSpeedIndex(const QString &sp);
static QString getSpeedName(int speed);
};
#endif
|