Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
raspberry_Holographic
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张泽仁
raspberry_Holographic
Commits
e170692d
Commit
e170692d
authored
Nov 03, 2023
by
张泽仁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
develop version 2023.11.3 back from suihua
parent
4c35b5cf
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
297 additions
and
54 deletions
+297
-54
interface.c
raspberrypi_spi/LocalDimming/interface.c
+203
-54
read.c
raspberrypi_spi/LocalDimming/read.c
+39
-0
send.c
raspberrypi_spi/LocalDimming/send.c
+55
-0
No files found.
raspberrypi_spi/LocalDimming/interface.c
View file @
e170692d
This diff is collapsed.
Click to expand it.
raspberrypi_spi/LocalDimming/read.c
0 → 100644
View file @
e170692d
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/spi/spidev.h>
#include <stdint.h>
#include <wiringPi.h>
#include <string.h>
int
main
()
{
int
fileuart
;
if
((
fileuart
=
serialOpen
(
"/dev/ttyAMA0"
,
9600
))
<
0
)
{
printf
(
"/dev/ttyAMA0 Open Faild
\r\n
"
);
// return 0;
}
printf
(
"/dev/ttyAMA0 Open success
\r\n
"
);
char
message
[
9
]
=
{
0x40
,
0x38
,
0xb
,
0x6
,
0x0
,
0x2
,
0x1
,
0x2b
,
0x58
};
write
(
fileuart
,
message
,
9
);
char
buf
[
100
]
=
{
0
};
int
recbytenum
=
serialDataAvail
(
filedevid
);
for
(
int
i
=
0
;
i
<
recbytenum
;
i
++
)
{
buf
[
i
]
=
serialGetchar
(
filedevid
);
}
for
(
int
i
=
0
;
i
<
recbytenum
;
i
++
)
{
printf
(
"%x "
,
buf
[
i
]);
}
printf
(
"
\n
"
);
int
angle
=
(
buf
[
7
]
<<
24
)
|
(
buf
[
8
]
<<
16
)
|
(
buf
[
9
]
<<
8
)
|
buf
[
10
];
printf
(
"angle = %d
\n
"
,
angle
);
return
0
;
}
\ No newline at end of file
raspberrypi_spi/LocalDimming/send.c
0 → 100644
View file @
e170692d
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
// crc
uint16_t
CrcValueCalc
(
uint8_t
*
cpucData
,
uint16_t
usLength
)
// changed
{
uint16_t
crcValue
=
0xffff
;
int
i
;
while
(
usLength
--
)
{
crcValue
^=
*
cpucData
++
;
for
(
i
=
8
-
1
;
i
>=
0
;
i
--
)
{
if
(
crcValue
&
0x0001
)
{
crcValue
=
(
crcValue
>>
1
)
^
0xa001
;
}
else
{
crcValue
=
crcValue
>>
1
;
}
}
}
return
crcValue
;
}
int
main
()
{
//a 10 b11 c12 d13
unsigned
char
mess
[
13
]
=
{
0x40
,
0x38
,
0x0b
,
0x06
,
0x00
,
0x02
,
0x01
,
0xff
,
0xff
,
0xff
,
0xa6
,
0x00
,
0x00
};
uint16_t
crc
=
CrcValueCalc
(
mess
,
11
);
mess
[
11
]
=
crc
&
0xff
;
mess
[
12
]
=
(
crc
>>
8
)
&
0xff
;
for
(
int
i
=
0
;
i
<
13
;
i
++
)
{
printf
(
"0x%x, "
,
mess
[
i
]);
}
printf
(
"
\n
"
);
return
0
;
}
// 120 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0x0, 0x0, 0x4, 0xb0, 0x1e, 0x7c,
// 0 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1d, 0x8,
// 60 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0x0, 0x0, 0x2, 0x58, 0x1d, 0x92,
// 90 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0x0, 0x0, 0x8, 0x84, 0x1a, 0xab,
// 150 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0x0, 0x0, 0x5, 0xdc, 0x1f, 0xc1,
// 30 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0x0, 0x0, 0x1, 0x2c, 0x1d, 0x45,
// 85 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0x0, 0x0, 0x3, 0x52, 0x9c, 0x5
// -25 0x40, 0x38, 0xb, 0x6, 0x0, 0x2, 0x1, 0xff, 0xff, 0xff, 0xe7, 0x1c, 0x96,
\ No newline at end of file
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