Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ArduinoCore-avr
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
ArduinoCore-avr
Commits
3883e49b
Unverified
Commit
3883e49b
authored
Sep 16, 2019
by
Alexander Entinger
Committed by
GitHub
Sep 16, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #82 from luco5826/master
Minor optimization in shiftOut function
parents
ffeca151
4d074e8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
cores/arduino/wiring_shift.c
cores/arduino/wiring_shift.c
+7
-4
No files found.
cores/arduino/wiring_shift.c
View file @
3883e49b
...
@@ -42,10 +42,13 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
...
@@ -42,10 +42,13 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
uint8_t
i
;
uint8_t
i
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
bitOrder
==
LSBFIRST
)
if
(
bitOrder
==
LSBFIRST
)
{
digitalWrite
(
dataPin
,
!!
(
val
&
(
1
<<
i
)));
digitalWrite
(
dataPin
,
val
&
1
);
else
val
>>=
1
;
digitalWrite
(
dataPin
,
!!
(
val
&
(
1
<<
(
7
-
i
))));
}
else
{
digitalWrite
(
dataPin
,
(
val
&
128
)
!=
0
);
val
<<=
1
;
}
digitalWrite
(
clockPin
,
HIGH
);
digitalWrite
(
clockPin
,
HIGH
);
digitalWrite
(
clockPin
,
LOW
);
digitalWrite
(
clockPin
,
LOW
);
...
...
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