Username or Email
Password
Remember me
Sign in
Sign up
Add Paste
Add Collection
unnamed file
C/C++
Shift Register
Guest
Download
Edit
/*
* Shift Register helper function
* shifts one array around one bit and appends value
*/
void
shiftRegister
(
uint8_t
*
array
,
uint8_t
value
)
{
int
len
=
(
WIDTH
*
HEIGHT
/
8
)
-
1
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
array
[
i
]
=
(
array
[
i
]
>>
1
)
|
((
array
[
i
+1
]
&
1
)
<<
7
)
;
}
array
[
len
]
=
(
array
[
len
]
>>
1
)
|
(
value
>
0
?
1
<<
7
:
0
)
;
}