Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
picsimlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
picsimlab
Commits
867225c0
Commit
867225c0
authored
Jul 29, 2020
by
lcgamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new: Support to save clock speed for each board
parent
057a1f28
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
82 additions
and
27 deletions
+82
-27
src/boards/board_0.cc
src/boards/board_0.cc
+5
-0
src/boards/board_1.cc
src/boards/board_1.cc
+6
-0
src/boards/board_2.cc
src/boards/board_2.cc
+6
-0
src/boards/board_3.cc
src/boards/board_3.cc
+7
-1
src/boards/board_4.cc
src/boards/board_4.cc
+8
-3
src/boards/board_5.cc
src/boards/board_5.cc
+6
-0
src/boards/board_6.cc
src/boards/board_6.cc
+5
-1
src/boards/board_7.cc
src/boards/board_7.cc
+6
-0
src/boards/board_x.cc
src/boards/board_x.cc
+7
-0
src/parts/part_MI2C_24CXXX.cc
src/parts/part_MI2C_24CXXX.cc
+1
-1
src/picsimlab1.cc
src/picsimlab1.cc
+23
-21
src/picsimlab1.h
src/picsimlab1.h
+2
-0
No files found.
src/boards/board_0.cc
View file @
867225c0
...
...
@@ -211,6 +211,7 @@ cboard_0::WritePreferences(void)
{
//write selected microcontroller of board_x to preferences
Window1
.
saveprefs
(
lxT
(
"p0_proc"
),
Proc
);
Window1
.
saveprefs
(
lxT
(
"p0_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
//Called whe configuration file load preferences
...
...
@@ -223,6 +224,10 @@ cboard_0::ReadPreferences(char *name, char *value)
{
Proc
=
value
;
}
if
(
!
strcmp
(
name
,
"p0_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
...
...
src/boards/board_1.cc
View file @
867225c0
...
...
@@ -640,6 +640,7 @@ cboard_1::WritePreferences(void)
{
Window1
.
saveprefs
(
lxT
(
"p1_proc"
),
Proc
);
Window1
.
saveprefs
(
lxT
(
"p1_jmp"
),
String
().
Format
(
"%i"
,
jmp
[
0
]));
Window1
.
saveprefs
(
lxT
(
"p1_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
void
...
...
@@ -662,6 +663,11 @@ cboard_1::ReadPreferences(char *name, char *value)
{
Proc
=
value
;
}
if
(
!
strcmp
(
name
,
"p1_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
board_init
(
1
,
"McLab1"
,
cboard_1
);
...
...
src/boards/board_2.cc
View file @
867225c0
...
...
@@ -740,6 +740,7 @@ void
cboard_2
::
WritePreferences
(
void
)
{
Window1
.
saveprefs
(
lxT
(
"p2_proc"
),
Proc
);
Window1
.
saveprefs
(
lxT
(
"p2_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
void
...
...
@@ -750,6 +751,11 @@ cboard_2::ReadPreferences(char *name, char *value)
{
Proc
=
value
;
}
if
(
!
strcmp
(
name
,
"p2_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
void
...
...
src/boards/board_3.cc
View file @
867225c0
...
...
@@ -1107,7 +1107,8 @@ cboard_3::WritePreferences(void)
sprintf
(
line
+
i
,
"%i"
,
jmp
[
i
]);
Window1
.
saveprefs
(
lxT
(
"p3_jmp"
),
line
);
};
Window1
.
saveprefs
(
lxT
(
"p3_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
void
cboard_3
::
ReadPreferences
(
char
*
name
,
char
*
value
)
...
...
@@ -1128,6 +1129,11 @@ cboard_3::ReadPreferences(char *name, char *value)
jmp
[
i
]
=
1
;
}
}
if
(
!
strcmp
(
name
,
"p3_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
...
...
src/boards/board_4.cc
View file @
867225c0
...
...
@@ -1881,8 +1881,8 @@ cboard_4::WritePreferences(void)
sprintf
(
line
+
i
,
"%i"
,
dip
[
i
]);
Window1
.
saveprefs
(
lxT
(
"p4_dip"
),
line
);
}
;
Window1
.
saveprefs
(
lxT
(
"p4_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
void
cboard_4
::
ReadPreferences
(
char
*
name
,
char
*
value
)
...
...
@@ -1925,7 +1925,12 @@ cboard_4::ReadPreferences(char *name, char *value)
else
lcd_init
(
&
lcd
,
16
,
4
);
}
};
if
(
!
strcmp
(
name
,
"p4_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
//Change lcd
...
...
src/boards/board_5.cc
View file @
867225c0
...
...
@@ -353,6 +353,7 @@ cboard_5::WritePreferences(void)
{
//write selected microcontroller of board_x to preferences
Window1
.
saveprefs
(
lxT
(
"p5_proc"
),
Proc
);
Window1
.
saveprefs
(
lxT
(
"p5_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
//Called whe configuration file load preferences
...
...
@@ -365,6 +366,11 @@ cboard_5::ReadPreferences(char *name, char *value)
{
Proc
=
value
;
}
if
(
!
strcmp
(
name
,
"p5_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
...
...
src/boards/board_6.cc
View file @
867225c0
...
...
@@ -297,6 +297,7 @@ cboard_6::WritePreferences(void)
{
//write selected microcontroller of board_6 to preferences
Window1
.
saveprefs
(
lxT
(
"p6_proc"
),
Proc
);
Window1
.
saveprefs
(
lxT
(
"p6_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
//Called whe configuration file load preferences
...
...
@@ -309,7 +310,10 @@ cboard_6::ReadPreferences(char *name, char *value)
{
Proc
=
value
;
}
if
(
!
strcmp
(
name
,
"p6_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
...
...
src/boards/board_7.cc
View file @
867225c0
...
...
@@ -305,6 +305,7 @@ cboard_7::WritePreferences(void)
//write selected microcontroller of board_5 to preferences
Window1
.
saveprefs
(
lxT
(
"p7_proc"
),
Proc
);
Window1
.
saveprefs
(
lxT
(
"p7_jmp"
),
String
().
Format
(
"%i"
,
jmp
[
0
]));
Window1
.
saveprefs
(
lxT
(
"p7_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
//Called whe configuration file load preferences
...
...
@@ -329,6 +330,11 @@ cboard_7::ReadPreferences(char *name, char *value)
jmp
[
i
]
=
1
;
}
}
if
(
!
strcmp
(
name
,
"p7_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
...
...
src/boards/board_x.cc
View file @
867225c0
...
...
@@ -247,6 +247,8 @@ cboard_x::WritePreferences(void)
Window1
.
saveprefs
(
lxT
(
"px_proc"
),
Proc
);
//write switch state of board_x to preferences
Window1
.
saveprefs
(
lxT
(
"px_bt2"
),
String
().
Format
(
"%i"
,
p_BT2
));
//write microcontroller clock to preferences
Window1
.
saveprefs
(
lxT
(
"px_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
}
//Called whe configuration file load preferences
...
...
@@ -267,6 +269,11 @@ cboard_x::ReadPreferences(char *name, char *value)
{
Proc
=
value
;
}
//read microcontroller clock
if
(
!
strcmp
(
name
,
"px_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
}
...
...
src/parts/part_MI2C_24CXXX.cc
View file @
867225c0
...
...
@@ -456,7 +456,7 @@ cpart_MI2C_24CXXX::filedialog_EvOnClose(int retId)
{
fwrite
(
mi2c
.
data
,
mi2c
.
SIZE
,
1
,
fout
);
fclose
(
fout
);
strncpy
(
f_mi2c_name
,
Window5
.
filedialog1
.
GetFileName
(),
200
);
strncpy
(
f_mi2c_name
,
Window5
.
filedialog1
.
GetFileName
(),
199
);
}
else
{
...
...
src/picsimlab1.cc
View file @
867225c0
...
...
@@ -268,7 +268,6 @@ CPWindow1::Configure(CControl * control, const char * home)
int
i
,
j
;
int
lc
;
float
clk
;
String
status
;
...
...
@@ -338,24 +337,6 @@ CPWindow1::Configure(CControl * control, const char * home)
dc
++
;
}
}
if
(
!
strcmp
(
name
,
"clock"
))
{
sscanf
(
value
,
"%f"
,
&
clk
);
if
(
clk
<
1
)
{
combo1
.
SetText
(
String
().
Format
(
"%2.1f"
,
clk
));
}
else
{
combo1
.
SetText
(
String
().
Format
(
"%2.0f"
,
clk
));
}
//combo1_EvOnComboChange(control);
NSTEP
=
(
int
)
(
atof
(
combo1
.
GetText
())
*
NSTEPKT
);
NSTEPJ
=
NSTEP
/
JUMPSTEPS
;
pboard
->
MSetFreq
(
NSTEP
*
NSTEPKF
);
}
if
(
!
strcmp
(
name
,
"debug"
))
...
...
@@ -611,7 +592,6 @@ CPWindow1::_EvOnDestroy(CControl * control)
saveprefs
(
lxT
(
"lab"
),
String
().
Format
(
"%i"
,
lab
));
saveprefs
(
lxT
(
"clock"
),
combo1
.
GetText
());
saveprefs
(
lxT
(
"debug"
),
itoa
(
debug
));
saveprefs
(
lxT
(
"debugt"
),
itoa
(
debug_type
));
saveprefs
(
lxT
(
"debugp"
),
itoa
(
debug_port
));
...
...
@@ -1095,7 +1075,6 @@ CPWindow1::filedialog2_EvOnClose(int retId)
snprintf
(
fname
,
1279
,
"%s/picsimlab.ini"
,
home
);
prefs
.
Clear
();
saveprefs
(
lxT
(
"lab"
),
String
().
Format
(
"%i"
,
lab
));
saveprefs
(
lxT
(
"clock"
),
combo1
.
GetText
());
saveprefs
(
lxT
(
"debug"
),
itoa
(
debug
));
saveprefs
(
lxT
(
"debugt"
),
itoa
(
debug_type
));
saveprefs
(
lxT
(
"debugp"
),
itoa
(
debug_port
));
...
...
@@ -1231,6 +1210,29 @@ CPWindow1::SetJUMPSTEPS(int js)
}
}
void
CPWindow1
::
SetClock
(
float
clk
)
{
if
(
clk
<
1
)
{
combo1
.
SetText
(
String
().
Format
(
"%2.1f"
,
clk
));
}
else
{
combo1
.
SetText
(
String
().
Format
(
"%2.0f"
,
clk
));
}
//combo1_EvOnComboChange(control);
NSTEP
=
(
int
)
(
atof
(
combo1
.
GetText
())
*
NSTEPKT
);
NSTEPJ
=
NSTEP
/
JUMPSTEPS
;
pboard
->
MSetFreq
(
NSTEP
*
NSTEPKF
);
}
float
CPWindow1
::
GetClock
(
void
)
{
return
atof
(
combo1
.
GetText
());
}
#ifdef __EMSCRIPTEN__
...
...
src/picsimlab1.h
View file @
867225c0
...
...
@@ -275,6 +275,8 @@ public:
void
menu1_EvMicrocontroller
(
CControl
*
control
);
void
LoadWorkspace
(
String
fnpzw
);
void
LoadHexFile
(
String
fname
);
void
SetClock
(
float
clk
);
float
GetClock
(
void
);
private:
String
share
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment