Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
90d7c4ef
Commit
90d7c4ef
authored
May 24, 2015
by
Daniel Campora
Browse files
cc3200: Make HeartBeat.disable() thread safe.
parent
1a97f672
Changes
1
Hide whitespace changes
Inline
Side-by-side
cc3200/misc/mperror.c
View file @
90d7c4ef
...
@@ -68,7 +68,8 @@ struct mperror_heart_beat {
...
@@ -68,7 +68,8 @@ struct mperror_heart_beat {
uint32_t
on_time
;
uint32_t
on_time
;
bool
beating
;
bool
beating
;
bool
enabled
;
bool
enabled
;
}
mperror_heart_beat
=
{.
off_time
=
0
,
.
on_time
=
0
,
.
beating
=
false
,
.
enabled
=
false
};
bool
do_disable
;
}
mperror_heart_beat
=
{.
off_time
=
0
,
.
on_time
=
0
,
.
beating
=
false
,
.
enabled
=
false
,
.
do_disable
=
false
};
/******************************************************************************
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
DEFINE PUBLIC FUNCTIONS
...
@@ -142,12 +143,16 @@ void mperror_heartbeat_switch_off (void) {
...
@@ -142,12 +143,16 @@ void mperror_heartbeat_switch_off (void) {
}
}
void
mperror_disable_heartbeat
(
void
)
{
void
mperror_disable_heartbeat
(
void
)
{
mperror_heart_beat
.
enabled
=
false
;
mperror_heart_beat
.
do_disable
=
true
;
mperror_heartbeat_switch_off
();
}
}
void
mperror_heartbeat_signal
(
void
)
{
void
mperror_heartbeat_signal
(
void
)
{
if
(
mperror_heart_beat
.
enabled
)
{
if
(
mperror_heart_beat
.
do_disable
)
{
mperror_heart_beat
.
enabled
=
false
;
mperror_heart_beat
.
do_disable
=
false
;
mperror_heartbeat_switch_off
();
}
else
if
(
mperror_heart_beat
.
enabled
)
{
if
(
!
mperror_heart_beat
.
beating
)
{
if
(
!
mperror_heart_beat
.
beating
)
{
if
((
mperror_heart_beat
.
on_time
=
HAL_GetTick
())
-
mperror_heart_beat
.
off_time
>
MPERROR_HEARTBEAT_OFF_MS
)
{
if
((
mperror_heart_beat
.
on_time
=
HAL_GetTick
())
-
mperror_heart_beat
.
off_time
>
MPERROR_HEARTBEAT_OFF_MS
)
{
MAP_GPIOPinWrite
(
MICROPY_SYS_LED_PORT
,
MICROPY_SYS_LED_PORT_PIN
,
MICROPY_SYS_LED_PORT_PIN
);
MAP_GPIOPinWrite
(
MICROPY_SYS_LED_PORT
,
MICROPY_SYS_LED_PORT_PIN
,
MICROPY_SYS_LED_PORT_PIN
);
...
...
Write
Preview
Supports
Markdown
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