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
761f22b0
Commit
761f22b0
authored
Oct 26, 2023
by
张泽仁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
release version for only uart sent angle
parent
c4f0e457
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
11 deletions
+46
-11
interface.c
raspberrypi_spi/LocalDimming/interface.c
+46
-11
No files found.
raspberrypi_spi/LocalDimming/interface.c
View file @
761f22b0
...
...
@@ -31,8 +31,6 @@ int count = 1;
int
fileusb
;
int
fileuart
;
int
spi_fd
;
...
...
@@ -140,9 +138,46 @@ uint16_t CrcValueCalc(const uint8_t *cpucData, uint16_t usLength)
return
crcValue
;
}
void
sendMessageHead
(
int
mode
,
char
*
message
)
{
*
(
message
)
=
0x40
;
*
(
message
+
1
)
=
0x38
;
// head
if
(
mode
==
0
)
// read
{
*
(
message
+
2
)
=
0x07
;
//length
*
(
message
+
3
)
=
0x03
;
//instru
*
(
message
+
4
)
=
0x00
;
//reg0
*
(
message
+
6
)
=
0x01
;
//ack
}
else
{
// write
*
(
message
+
2
)
=
0x0b
;
//length
*
(
message
+
3
)
=
0x06
;
//instru
*
(
message
+
4
)
=
0x00
;
//reg0
*
(
message
+
5
)
=
0x02
;
//reg1 write angle
*
(
message
+
6
)
=
0x00
;
//ack
}
}
void
sentMessageAngle
(
int
fileuart
,
uint16_t
angle
)
//changed
{
char
messageAngle
[
13
];
sendMessageHead
(
1
,
messageAngle
);
messageAngle
[
7
]
=
0x00
;
messageAngle
[
8
]
=
0x00
;
messageAngle
[
9
]
=
(
angle
>>
8
)
&
0xff
;
messageAngle
[
10
]
=
angle
&
0xff
;
uint16_t
crc
;
crc
=
CrcValueCalc
(
messageAngle
,
11
);
messageAngle
[
11
]
=
(
crc
>>
8
)
&
0xff
;
messageAngle
[
12
]
=
crc
&
0xff
;
write
(
fileuart
,
messageAngle
,
11
);
}
extern
int
get_audio_device_id
();
void
releaseAckeachwakenwords
(
char
*
totalbuf
)
void
releaseAckeachwakenwords
(
char
*
totalbuf
)
//used for test
{
char
*
p
=
totalbuf
;
while
(
*
p
!=
'k'
||
*
(
p
+
1
)
!=
'e'
)
...
...
@@ -156,8 +191,12 @@ void releaseAckeachwakenwords(char* totalbuf)
//system("mpg321 /usr/local/bin/Videos/aaaa.mp3 &");
//system("cvlc --play-and-exit --aout alsa --alsa-audio-device hw:2,0 /usr/local/bin/Videos/aaaa.mp3 &");
system
(
buf
);
g_callback
(
g_callback_ctx
,
2
);
}
uint16_t
angle
;
angle
=
getAngle
(
totalbuf
);
sentMessageAngle
(
fileuart
,
angle
);
switch
(
*
p
)
{
case
'x'
:
...
...
@@ -172,6 +211,7 @@ void releaseAckeachwakenwords(char* totalbuf)
default:
break
;
}
usleep
(
100
);
}
...
...
@@ -180,13 +220,7 @@ void sentUart(char *buf, int fileuart)
if
(
count
==
9
)
{
strcat
(
totalbuf
,
buf
);
uint16_t
angle
;
angle
=
getAngle
(
totalbuf
);
printf
(
"angle = %x
\n
"
,
angle
);
char
angleret
[
2
];
angleret
[
1
]
=
angle
&
0xff
;
angleret
[
0
]
=
(
angle
>>
8
)
&
0xff
;
write
(
fileuart
,
angleret
,
2
);
count
=
1
;
memset
(
totalbuf
,
0
,
1024
);
...
...
@@ -224,6 +258,7 @@ void circleReading()
else
{
sentUart
(
buf
,
fileuart
);
printf
(
" %d
\n
"
,
__LINE__
);
serialFlush
(
fileusb
);
}
}
...
...
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