Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
marlin-anet-a8
Commits
d48cb6bf
Commit
d48cb6bf
authored
Nov 17, 2017
by
Scott Lahteine
Browse files
Options
Downloads
Patches
Plain Diff
Apply coding standards to Max7219
parent
1502b6ad
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Marlin/src/feature/Max7219_Debug_LEDs.cpp
+50
-81
50 additions, 81 deletions
Marlin/src/feature/Max7219_Debug_LEDs.cpp
with
50 additions
and
81 deletions
Marlin/src/feature/Max7219_Debug_LEDs.cpp
+
50
−
81
View file @
d48cb6bf
...
@@ -102,12 +102,9 @@ void Max7219(const uint8_t reg, const uint8_t data) {
...
@@ -102,12 +102,9 @@ void Max7219(const uint8_t reg, const uint8_t data) {
void
Max7219_LED_Set
(
const
uint8_t
row
,
const
uint8_t
col
,
const
bool
on
)
{
void
Max7219_LED_Set
(
const
uint8_t
row
,
const
uint8_t
col
,
const
bool
on
)
{
if
(
row
>
7
||
col
>
7
)
{
if
(
row
>
7
||
col
>
7
)
{
int
r
,
c
;
SERIAL_ECHOPAIR
(
"??? Max7219_LED_Set("
,
(
int
)
row
);
r
=
row
;
SERIAL_ECHOPAIR
(
","
,
(
int
)
col
);
c
=
col
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_LED_Set("
,
r
);
SERIAL_ECHOPAIR
(
","
,
c
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
if
(
TEST
(
LEDs
[
row
],
col
)
==
on
)
return
;
// if LED is already on/off, leave alone
if
(
TEST
(
LEDs
[
row
],
col
)
==
on
)
return
;
// if LED is already on/off, leave alone
...
@@ -117,12 +114,9 @@ void Max7219_LED_Set(const uint8_t row, const uint8_t col, const bool on) {
...
@@ -117,12 +114,9 @@ void Max7219_LED_Set(const uint8_t row, const uint8_t col, const bool on) {
void
Max7219_LED_On
(
const
uint8_t
col
,
const
uint8_t
row
)
{
void
Max7219_LED_On
(
const
uint8_t
col
,
const
uint8_t
row
)
{
if
(
row
>
7
||
col
>
7
)
{
if
(
row
>
7
||
col
>
7
)
{
int
r
,
c
;
SERIAL_ECHOPAIR
(
"??? Max7219_LED_On("
,
(
int
)
col
);
r
=
row
;
SERIAL_ECHOPAIR
(
","
,
(
int
)
row
);
c
=
col
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_LED_On("
,
c
);
SERIAL_ECHOPAIR
(
","
,
r
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
Max7219_LED_Set
(
col
,
row
,
true
);
Max7219_LED_Set
(
col
,
row
,
true
);
...
@@ -130,12 +124,9 @@ void Max7219_LED_On(const uint8_t col, const uint8_t row) {
...
@@ -130,12 +124,9 @@ void Max7219_LED_On(const uint8_t col, const uint8_t row) {
void
Max7219_LED_Off
(
const
uint8_t
col
,
const
uint8_t
row
)
{
void
Max7219_LED_Off
(
const
uint8_t
col
,
const
uint8_t
row
)
{
if
(
row
>
7
||
col
>
7
)
{
if
(
row
>
7
||
col
>
7
)
{
int
r
,
c
;
SERIAL_ECHOPAIR
(
"??? Max7219_LED_Off("
,
(
int
)
row
);
r
=
row
;
SERIAL_ECHOPAIR
(
","
,
(
int
)
col
);
c
=
col
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_LED_Off("
,
r
);
SERIAL_ECHOPAIR
(
","
,
c
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
Max7219_LED_Set
(
col
,
row
,
false
);
Max7219_LED_Set
(
col
,
row
,
false
);
...
@@ -143,12 +134,9 @@ void Max7219_LED_Off(const uint8_t col, const uint8_t row) {
...
@@ -143,12 +134,9 @@ void Max7219_LED_Off(const uint8_t col, const uint8_t row) {
void
Max7219_LED_Toggle
(
const
uint8_t
col
,
const
uint8_t
row
)
{
void
Max7219_LED_Toggle
(
const
uint8_t
col
,
const
uint8_t
row
)
{
if
(
row
>
7
||
col
>
7
)
{
if
(
row
>
7
||
col
>
7
)
{
int
r
,
c
;
SERIAL_ECHOPAIR
(
"??? Max7219_LED_Toggle("
,
(
int
)
row
);
r
=
row
;
SERIAL_ECHOPAIR
(
","
,
(
int
)
col
);
c
=
col
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_LED_Toggle("
,
r
);
SERIAL_ECHOPAIR
(
","
,
c
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
if
(
TEST
(
LEDs
[
row
],
col
))
if
(
TEST
(
LEDs
[
row
],
col
))
...
@@ -159,10 +147,8 @@ void Max7219_LED_Toggle(const uint8_t col, const uint8_t row) {
...
@@ -159,10 +147,8 @@ void Max7219_LED_Toggle(const uint8_t col, const uint8_t row) {
void
Max7219_Clear_Column
(
const
uint8_t
col
)
{
void
Max7219_Clear_Column
(
const
uint8_t
col
)
{
if
(
col
>
7
)
{
if
(
col
>
7
)
{
int
c
;
SERIAL_ECHOPAIR
(
"??? Max7219_Clear_Column("
,
(
int
)
col
);
c
=
col
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_Clear_Column("
,
c
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
LEDs
[
col
]
=
0
;
LEDs
[
col
]
=
0
;
...
@@ -171,10 +157,8 @@ void Max7219_Clear_Column(const uint8_t col) {
...
@@ -171,10 +157,8 @@ void Max7219_Clear_Column(const uint8_t col) {
void
Max7219_Clear_Row
(
const
uint8_t
row
)
{
void
Max7219_Clear_Row
(
const
uint8_t
row
)
{
if
(
row
>
7
)
{
if
(
row
>
7
)
{
int
r
;
SERIAL_ECHOPAIR
(
"??? Max7219_Clear_Row("
,
(
int
)
row
);
r
=
row
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_Clear_Row("
,
r
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
for
(
uint8_t
c
=
0
;
c
<=
7
;
c
++
)
for
(
uint8_t
c
=
0
;
c
<=
7
;
c
++
)
...
@@ -182,13 +166,10 @@ void Max7219_Clear_Row(const uint8_t row) {
...
@@ -182,13 +166,10 @@ void Max7219_Clear_Row(const uint8_t row) {
}
}
void
Max7219_Set_Row
(
const
uint8_t
row
,
const
uint8_t
val
)
{
void
Max7219_Set_Row
(
const
uint8_t
row
,
const
uint8_t
val
)
{
if
(
row
>
7
||
val
>
255
)
{
if
(
row
>
7
)
{
int
r
,
v
;
SERIAL_ECHOPAIR
(
"??? Max7219_Set_Row("
,
(
int
)
row
);
r
=
row
;
SERIAL_ECHOPAIR
(
","
,
(
int
)
val
);
v
=
val
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_Set_Row("
,
r
);
SERIAL_ECHOPAIR
(
","
,
v
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
for
(
uint8_t
b
=
0
;
b
<=
7
;
b
++
)
for
(
uint8_t
b
=
0
;
b
<=
7
;
b
++
)
...
@@ -199,44 +180,34 @@ void Max7219_Set_Row(const uint8_t row, const uint8_t val) {
...
@@ -199,44 +180,34 @@ void Max7219_Set_Row(const uint8_t row, const uint8_t val) {
}
}
void
Max7219_Set_2_Rows
(
const
uint8_t
row
,
const
uint16_t
val
)
{
void
Max7219_Set_2_Rows
(
const
uint8_t
row
,
const
uint16_t
val
)
{
if
(
row
>
6
||
val
>
65535
)
{
if
(
row
>
6
)
{
int
r
,
v
;
SERIAL_ECHOPAIR
(
"??? Max7219_Set_2_Rows("
,
(
int
)
row
);
r
=
row
;
SERIAL_ECHOPAIR
(
","
,
(
int
)
val
);
v
=
val
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_Set_2_Rows("
,
r
);
SERIAL_ECHOPAIR
(
","
,
v
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
Max7219_Set_Row
(
row
+
1
,
(
val
&
0xff00
)
>>
8
);
Max7219_Set_Row
(
row
+
1
,
(
val
>>
8
)
&
0xFF
);
Max7219_Set_Row
(
row
+
0
,
(
val
&
0x
ff
)
);
Max7219_Set_Row
(
row
+
0
,
(
val
)
&
0x
FF
);
}
}
void
Max7219_Set_4_Rows
(
const
uint8_t
row
,
const
uint32_t
val
)
{
void
Max7219_Set_4_Rows
(
const
uint8_t
row
,
const
uint32_t
val
)
{
if
(
row
>
4
)
{
if
(
row
>
4
)
{
int
r
;
SERIAL_ECHOPAIR
(
"??? Max7219_Set_4_Rows("
,
(
int
)
row
);
long
v
;
SERIAL_ECHOPAIR
(
","
,
(
long
)
val
);
r
=
row
;
SERIAL_ECHOLNPGM
(
")"
);
v
=
val
;
SERIAL_ECHOPAIR
(
"??? Max7219_Set_4_Rows("
,
r
);
SERIAL_ECHOPAIR
(
","
,
v
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
Max7219_Set_Row
(
row
+
3
,
(
val
&
0xff000000
)
>>
24
);
Max7219_Set_Row
(
row
+
3
,
(
val
>>
24
)
&
0xFF
);
Max7219_Set_Row
(
row
+
2
,
(
val
&
0xff0000
)
>>
16
);
Max7219_Set_Row
(
row
+
2
,
(
val
>>
16
)
&
0xFF
);
Max7219_Set_Row
(
row
+
1
,
(
val
&
0xff00
)
>>
8
);
Max7219_Set_Row
(
row
+
1
,
(
val
>>
8
)
&
0xFF
);
Max7219_Set_Row
(
row
+
0
,
(
val
&
0x
ff
)
);
Max7219_Set_Row
(
row
+
0
,
(
val
)
&
0x
FF
);
}
}
void
Max7219_Set_Column
(
const
uint8_t
col
,
const
uint8_t
val
)
{
void
Max7219_Set_Column
(
const
uint8_t
col
,
const
uint8_t
val
)
{
if
(
val
>
255
||
col
>
7
)
{
if
(
col
>
7
)
{
int
v
,
c
;
SERIAL_ECHOPAIR
(
"??? Max7219_Column("
,
(
int
)
col
);
v
=
val
;
SERIAL_ECHOPAIR
(
","
,
(
int
)
val
);
c
=
col
;
SERIAL_ECHOLNPGM
(
")"
);
SERIAL_ECHOPAIR
(
"??? Max7219_Column("
,
c
);
SERIAL_ECHOPAIR
(
","
,
v
);
SERIAL_ECHO
(
")
\n
"
);
return
;
return
;
}
}
LEDs
[
col
]
=
val
;
LEDs
[
col
]
=
val
;
...
@@ -304,12 +275,10 @@ void Max7219_idle_tasks() {
...
@@ -304,12 +275,10 @@ void Max7219_idle_tasks() {
#if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE
#if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE
CRITICAL_SECTION_START
CRITICAL_SECTION_START
#if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_QUEUE
#if MAX7219_DEBUG_STEPPER_HEAD || MAX7219_DEBUG_STEPPER_QUEUE
uint8_t
head
;
const
uint8_t
head
=
planner
.
block_buffer_head
;
head
=
planner
.
block_buffer_head
;
#endif
#endif
#if MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE
#if MAX7219_DEBUG_STEPPER_TAIL || MAX7219_DEBUG_STEPPER_QUEUE
uint8_t
tail
;
const
uint8_t
tail
=
planner
.
block_buffer_tail
;
tail
=
planner
.
block_buffer_tail
;
#endif
#endif
CRITICAL_SECTION_END
CRITICAL_SECTION_END
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment