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
9b12bc78
Commit
9b12bc78
authored
Oct 29, 2015
by
Paul Sokolovsky
Browse files
cc3200: Switch from HAL_GetTick() to mp_hal_ticks_ms().
parent
19b671c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
cc3200/hal/cc3200_hal.c
View file @
9b12bc78
...
...
@@ -104,7 +104,7 @@ void HAL_IncrementTick(void) {
HAL_tickCount
++
;
}
uint32_t
HAL_GetTick
(
void
)
{
uint32_t
mp_hal_ticks_ms
(
void
)
{
return
HAL_tickCount
;
}
...
...
cc3200/hal/cc3200_hal.h
View file @
9b12bc78
...
...
@@ -62,7 +62,7 @@
extern
void
HAL_SystemInit
(
void
);
extern
void
HAL_SystemDeInit
(
void
);
extern
void
HAL_IncrementTick
(
void
);
extern
uint32_t
HAL_GetTick
(
void
);
extern
uint32_t
mp_hal_ticks_ms
(
void
);
extern
void
mp_hal_delay_ms
(
uint32_t
delay
);
extern
NORETURN
void
mp_hal_raise
(
int
errno
);
extern
void
mp_hal_set_interrupt_char
(
int
c
);
...
...
cc3200/misc/mperror.c
View file @
9b12bc78
...
...
@@ -151,12 +151,12 @@ void mperror_heartbeat_signal (void) {
mperror_heart_beat
.
do_disable
=
false
;
}
else
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
)
{
if
((
mperror_heart_beat
.
on_time
=
mp_hal_ticks_ms
())
-
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
);
mperror_heart_beat
.
beating
=
true
;
}
}
else
{
if
((
mperror_heart_beat
.
off_time
=
HAL_GetTick
())
-
mperror_heart_beat
.
on_time
>
MPERROR_HEARTBEAT_ON_MS
)
{
if
((
mperror_heart_beat
.
off_time
=
mp_hal_ticks_ms
())
-
mperror_heart_beat
.
on_time
>
MPERROR_HEARTBEAT_ON_MS
)
{
MAP_GPIOPinWrite
(
MICROPY_SYS_LED_PORT
,
MICROPY_SYS_LED_PORT_PIN
,
0
);
mperror_heart_beat
.
beating
=
false
;
}
...
...
cc3200/misc/mpsystick.c
View file @
9b12bc78
...
...
@@ -40,12 +40,12 @@
bool
sys_tick_has_passed
(
uint32_t
start_tick
,
uint32_t
delay_ms
)
{
return
HAL_GetTick
()
-
start_tick
>=
delay_ms
;
return
mp_hal_ticks_ms
()
-
start_tick
>=
delay_ms
;
}
// waits until at least delay_ms milliseconds have passed from the sampling of
// startTick. Handles overflow properly. Assumes stc was taken from
//
HAL_GetTick
() some time before calling this function.
//
mp_hal_ticks_ms
() some time before calling this function.
void
sys_tick_wait_at_least
(
uint32_t
start_tick
,
uint32_t
delay_ms
)
{
#ifdef USE_FREERTOS
vTaskDelay
(
delay_ms
/
portTICK_PERIOD_MS
);
...
...
@@ -58,11 +58,11 @@ void sys_tick_wait_at_least(uint32_t start_tick, uint32_t delay_ms) {
// The SysTick timer counts down at HAL_FCPU_HZ, so we can use that knowledge
// to grab a microsecond counter.
// We assume that
HAL_GetTick
returns milliseconds.
// We assume that
mp_hal_ticks_ms
returns milliseconds.
uint32_t
sys_tick_get_microseconds
(
void
)
{
mp_uint_t
irq_state
=
disable_irq
();
uint32_t
counter
=
SysTickValueGet
();
uint32_t
milliseconds
=
HAL_GetTick
();
uint32_t
milliseconds
=
mp_hal_ticks_ms
();
enable_irq
(
irq_state
);
uint32_t
load
=
SysTickPeriodGet
();
...
...
cc3200/mods/modutime.c
View file @
9b12bc78
...
...
@@ -151,7 +151,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_us_obj, time_sleep_us);
STATIC
mp_obj_t
time_ticks_ms
(
void
)
{
// We want to "cast" the 32 bit unsigned into a 30-bit small-int
return
MP_OBJ_NEW_SMALL_INT
(
HAL_GetTick
()
&
MP_SMALL_INT_POSITIVE_MASK
);
return
MP_OBJ_NEW_SMALL_INT
(
mp_hal_ticks_ms
()
&
MP_SMALL_INT_POSITIVE_MASK
);
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
time_ticks_ms_obj
,
time_ticks_ms
);
...
...
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