Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
360b25ab
Commit
360b25ab
authored
Mar 8, 2014
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stm: Add udelay (delay in microseconds).
parent
cd000645
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
stm/main.c
+11
-0
11 additions, 0 deletions
stm/main.c
stm/qstrdefsport.h
+1
-0
1 addition, 0 deletions
stm/qstrdefsport.h
with
12 additions
and
0 deletions
stm/main.c
+
11
−
0
View file @
360b25ab
...
@@ -110,6 +110,16 @@ mp_obj_t pyb_delay(mp_obj_t count) {
...
@@ -110,6 +110,16 @@ mp_obj_t pyb_delay(mp_obj_t count) {
return
mp_const_none
;
return
mp_const_none
;
}
}
mp_obj_t
pyb_udelay
(
mp_obj_t
usec
)
{
uint32_t
count
=
0
;
const
uint32_t
utime
=
(
168
*
mp_obj_get_int
(
usec
)
/
5
);
for
(;;)
{
if
(
++
count
>
utime
)
{
return
mp_const_none
;
}
}
}
void
fatality
(
void
)
{
void
fatality
(
void
)
{
led_state
(
PYB_LED_R1
,
1
);
led_state
(
PYB_LED_R1
,
1
);
led_state
(
PYB_LED_G1
,
1
);
led_state
(
PYB_LED_G1
,
1
);
...
@@ -415,6 +425,7 @@ soft_reset:
...
@@ -415,6 +425,7 @@ soft_reset:
rt_store_attr
(
m
,
MP_QSTR_main
,
rt_make_function_n
(
1
,
pyb_main
));
rt_store_attr
(
m
,
MP_QSTR_main
,
rt_make_function_n
(
1
,
pyb_main
));
rt_store_attr
(
m
,
MP_QSTR_sync
,
rt_make_function_n
(
0
,
pyb_sync
));
rt_store_attr
(
m
,
MP_QSTR_sync
,
rt_make_function_n
(
0
,
pyb_sync
));
rt_store_attr
(
m
,
MP_QSTR_delay
,
rt_make_function_n
(
1
,
pyb_delay
));
rt_store_attr
(
m
,
MP_QSTR_delay
,
rt_make_function_n
(
1
,
pyb_delay
));
rt_store_attr
(
m
,
MP_QSTR_udelay
,
rt_make_function_n
(
1
,
pyb_udelay
));
#if MICROPY_HW_HAS_SWITCH
#if MICROPY_HW_HAS_SWITCH
rt_store_attr
(
m
,
MP_QSTR_switch
,
(
mp_obj_t
)
&
pyb_switch_obj
);
rt_store_attr
(
m
,
MP_QSTR_switch
,
(
mp_obj_t
)
&
pyb_switch_obj
);
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
stm/qstrdefsport.h
+
1
−
0
View file @
360b25ab
...
@@ -11,6 +11,7 @@ Q(main)
...
@@ -11,6 +11,7 @@ Q(main)
Q
(
sync
)
Q
(
sync
)
Q
(
gc
)
Q
(
gc
)
Q
(
delay
)
Q
(
delay
)
Q
(
udelay
)
Q
(
switch
)
Q
(
switch
)
Q
(
SW
)
Q
(
SW
)
Q
(
servo
)
Q
(
servo
)
...
...
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