Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
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
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Skyward Boardcore
Commits
4bfbd23d
Commit
4bfbd23d
authored
2 years ago
by
Davide Mor
Browse files
Options
Downloads
Patches
Plain Diff
[cc3135] Added guards to installAsServiceThread
parent
95a31bf7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/shared/radio/CC3135/CC3135.cpp
+6
-14
6 additions, 14 deletions
src/shared/radio/CC3135/CC3135.cpp
src/shared/radio/CC3135/CC3135.h
+14
-0
14 additions, 0 deletions
src/shared/radio/CC3135/CC3135.h
with
20 additions
and
14 deletions
src/shared/radio/CC3135/CC3135.cpp
+
6
−
14
View file @
4bfbd23d
...
...
@@ -49,9 +49,6 @@ CC3135::CC3135(std::unique_ptr<ICC3135Iface> &&iface) : iface(std::move(iface))
CC3135
::
Error
CC3135
::
init
(
bool
wait_for_init
)
{
if
(
iface
->
is_spi
())
dummyDeviceRead
();
if
(
wait_for_init
)
{
DeviceInitInfo
init_info
=
{};
...
...
@@ -193,7 +190,7 @@ void CC3135::run()
{
// Lock the device interface
Lock
<
FastMutex
>
lock
(
iface_mutex
);
Lock
<
FastMutex
>
iface_
lock
(
iface_mutex
);
ResponseHeader
header
;
Error
result
=
readHeader
(
&
header
);
...
...
@@ -217,16 +214,13 @@ CC3135::Error CC3135::inoutPacketSync(CC3135Defs::OpCode tx_opcode,
CC3135
::
Buffer
rx_command
,
CC3135
::
Buffer
rx_payload
)
{
installAsS
ervice
T
hread
(
);
ServiceThreadLock
s
ervice
_t
hread
_lock
(
this
);
// Lock the device interface
Lock
<
FastMutex
>
lock
(
iface_mutex
);
Lock
<
FastMutex
>
iface_
lock
(
iface_mutex
);
TRY
(
writePacket
(
tx_opcode
,
tx_command
,
tx_payload
));
TRY
(
readPacket
(
rx_opcode
,
rx_command
,
rx_payload
));
restoreDefaultServiceThread
();
return
Error
::
NO_ERROR
;
}
...
...
@@ -234,14 +228,12 @@ CC3135::Error CC3135::readPacketSync(CC3135Defs::OpCode opcode,
CC3135
::
Buffer
command
,
CC3135
::
Buffer
payload
)
{
installAsS
ervice
T
hread
(
);
ServiceThreadLock
s
ervice
_t
hread
_lock
(
this
);
// Lock the device interface
Lock
<
FastMutex
>
lock
(
iface_mutex
);
Lock
<
FastMutex
>
iface_
lock
(
iface_mutex
);
TRY
(
readPacket
(
opcode
,
command
,
payload
));
restoreDefaultServiceThread
();
return
Error
::
NO_ERROR
;
}
...
...
@@ -250,7 +242,7 @@ CC3135::Error CC3135::writePacketSync(CC3135Defs::OpCode opcode,
CC3135
::
Buffer
payload
)
{
// Lock the device interface
Lock
<
FastMutex
>
lock
(
iface_mutex
);
Lock
<
FastMutex
>
iface_
lock
(
iface_mutex
);
TRY
(
writePacket
(
opcode
,
command
,
payload
));
return
Error
::
NO_ERROR
;
...
...
This diff is collapsed.
Click to expand it.
src/shared/radio/CC3135/CC3135.h
+
14
−
0
View file @
4bfbd23d
...
...
@@ -76,6 +76,20 @@ private:
static
Buffer
null
()
{
return
{
nullptr
,
0
};
}
};
class
ServiceThreadLock
{
public:
ServiceThreadLock
(
CC3135
*
parent
)
:
parent
(
parent
)
{
parent
->
installAsServiceThread
();
}
~
ServiceThreadLock
()
{
parent
->
restoreDefaultServiceThread
();
}
private
:
CC3135
*
parent
;
};
//! Function for servicing async messages.
void
run
()
override
;
...
...
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