Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
09721e23
Commit
09721e23
authored
Mar 12, 2015
by
danicampora
Browse files
cc3200: Increase heartbeat period from 3 to 5 seconds.
parent
c7fabe1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
cc3200/misc/mperror.c
View file @
09721e23
...
...
@@ -54,14 +54,26 @@
#define MPERROR_TOOGLE_MS (40)
#define MPERROR_SIGNAL_ERROR_MS (1000)
#define MPERROR_HEARTBEAT_ON_MS (80)
#define MPERROR_HEARTBEAT_OFF_MS (
2
920)
#define MPERROR_HEARTBEAT_OFF_MS (
4
920)
#define MPERROR_SAFE_BOOT_REG_IDX (0)
/******************************************************************************
DECLARE PRIVATE DATA
******************************************************************************/
static
bool
mperror_heartbeat_enabled
;
struct
mperror_heart_beat
{
uint32_t
off_time
;
uint32_t
on_time
;
bool
beating
;
bool
enabled
;
}
mperror_heart_beat
;
/******************************************************************************
DEFINE PRIVATE FUNCTIONS
******************************************************************************/
STATIC
void
mperror_heartbeat_switch_off
(
void
)
{
MAP_GPIOPinWrite
(
MICROPY_SYS_LED_PORT
,
MICROPY_SYS_LED_PORT_PIN
,
0
);
}
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
...
...
@@ -84,6 +96,10 @@ void mperror_init0 (void) {
MAP_PinConfigSet
(
MICROPY_SAFE_BOOT_PIN_NUM
,
PIN_STRENGTH_4MA
,
PIN_TYPE_STD_PD
);
MAP_GPIODirModeSet
(
MICROPY_SAFE_BOOT_PORT
,
MICROPY_SAFE_BOOT_PORT_PIN
,
GPIO_DIR_MODE_IN
);
#endif
mperror_heart_beat
.
on_time
=
0
;
mperror_heart_beat
.
off_time
=
0
;
mperror_heart_beat
.
beating
=
false
;
}
void
mperror_check_reset_cause
(
void
)
{
...
...
@@ -136,39 +152,31 @@ bool mperror_safe_boot_requested (void) {
}
void
mperror_enable_heartbeat
(
void
)
{
mperror_heartbeat
_
enabled
=
true
;
mperror_heart
_
beat
.
enabled
=
true
;
}
void
mperror_disable_heartbeat
(
void
)
{
mperror_heartbeat
_
enabled
=
false
;
mperror_heartbeat_off
();
mperror_heart
_
beat
.
enabled
=
false
;
mperror_heartbeat_
switch_
off
();
}
void
mperror_heartbeat_signal
(
void
)
{
static
uint
off_start
=
0
;
static
uint
on_start
=
0
;
static
bool
beat
=
false
;
if
(
mperror_heartbeat_enabled
)
{
if
(
!
beat
)
{
if
((
on_start
=
HAL_GetTick
())
-
off_start
>
MPERROR_HEARTBEAT_OFF_MS
)
{
if
(
mperror_heart_beat
.
enabled
)
{
if
(
!
mperror_heart_beat
.
beating
)
{
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
);
beat
=
true
;
mperror_heart_beat
.
beating
=
true
;
}
}
else
{
if
((
off_start
=
HAL_GetTick
())
-
on_start
>
MPERROR_HEARTBEAT_ON_MS
)
{
mperror_heartbeat_off
();
beat
=
false
;
if
((
mperror_heart_beat
.
off_time
=
HAL_GetTick
())
-
mperror_heart_beat
.
on_time
>
MPERROR_HEARTBEAT_ON_MS
)
{
mperror_heartbeat_
switch_
off
();
mperror_heart_beat
.
beating
=
false
;
}
}
}
}
void
mperror_heartbeat_off
(
void
)
{
MAP_GPIOPinWrite
(
MICROPY_SYS_LED_PORT
,
MICROPY_SYS_LED_PORT_PIN
,
0
);
}
void
NORETURN
__fatal_error
(
const
char
*
msg
)
{
#ifdef DEBUG
if
(
msg
!=
NULL
)
{
...
...
cc3200/misc/mperror.h
View file @
09721e23
...
...
@@ -44,6 +44,5 @@ bool mperror_safe_boot_requested (void);
void
mperror_enable_heartbeat
(
void
);
void
mperror_disable_heartbeat
(
void
);
void
mperror_heartbeat_signal
(
void
);
void
mperror_heartbeat_off
(
void
);
#endif // MPERROR_H_
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment