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
f6be480b
Commit
f6be480b
authored
Apr 16, 2014
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stmhal: Add pyb.have_cdc function to check if USB CDC device is enabled.
parent
9388a908
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
stmhal/modpyb.c
+9
-2
9 additions, 2 deletions
stmhal/modpyb.c
stmhal/qstrdefsport.h
+1
-0
1 addition, 0 deletions
stmhal/qstrdefsport.h
with
10 additions
and
2 deletions
stmhal/modpyb.c
+
9
−
2
View file @
f6be480b
...
@@ -193,6 +193,12 @@ STATIC mp_obj_t pyb_standby(void) {
...
@@ -193,6 +193,12 @@ STATIC mp_obj_t pyb_standby(void) {
MP_DEFINE_CONST_FUN_OBJ_0
(
pyb_standby_obj
,
pyb_standby
);
MP_DEFINE_CONST_FUN_OBJ_0
(
pyb_standby_obj
,
pyb_standby
);
STATIC
mp_obj_t
pyb_have_cdc
(
void
)
{
return
MP_BOOL
(
usb_vcp_is_connected
());
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
pyb_have_cdc_obj
,
pyb_have_cdc
);
STATIC
mp_obj_t
pyb_hid_send_report
(
mp_obj_t
arg
)
{
STATIC
mp_obj_t
pyb_hid_send_report
(
mp_obj_t
arg
)
{
mp_obj_t
*
items
;
mp_obj_t
*
items
;
mp_obj_get_array_fixed_n
(
arg
,
4
,
&
items
);
mp_obj_get_array_fixed_n
(
arg
,
4
,
&
items
);
...
@@ -235,6 +241,9 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
...
@@ -235,6 +241,9 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_main
),
(
mp_obj_t
)
&
pyb_main_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_main
),
(
mp_obj_t
)
&
pyb_main_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_usb_mode
),
(
mp_obj_t
)
&
pyb_usb_mode_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_usb_mode
),
(
mp_obj_t
)
&
pyb_usb_mode_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_have_cdc
),
(
mp_obj_t
)
&
pyb_have_cdc_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_hid
),
(
mp_obj_t
)
&
pyb_hid_send_report_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_millis
),
(
mp_obj_t
)
&
pyb_millis_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_millis
),
(
mp_obj_t
)
&
pyb_millis_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_delay
),
(
mp_obj_t
)
&
pyb_delay_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_delay
),
(
mp_obj_t
)
&
pyb_delay_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_udelay
),
(
mp_obj_t
)
&
pyb_udelay_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_udelay
),
(
mp_obj_t
)
&
pyb_udelay_obj
},
...
@@ -278,8 +287,6 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
...
@@ -278,8 +287,6 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_Accel
),
(
mp_obj_t
)
&
pyb_accel_type
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_Accel
),
(
mp_obj_t
)
&
pyb_accel_type
},
#endif
#endif
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_hid
),
(
mp_obj_t
)
&
pyb_hid_send_report_obj
},
// input
// input
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_input
),
(
mp_obj_t
)
&
pyb_input_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_input
),
(
mp_obj_t
)
&
pyb_input_obj
},
...
...
This diff is collapsed.
Click to expand it.
stmhal/qstrdefsport.h
+
1
−
0
View file @
f6be480b
...
@@ -25,6 +25,7 @@ Q(read)
...
@@ -25,6 +25,7 @@ Q(read)
Q
(
readall
)
Q
(
readall
)
Q
(
readline
)
Q
(
readline
)
Q
(
write
)
Q
(
write
)
Q
(
have_cdc
)
Q
(
hid
)
Q
(
hid
)
Q
(
time
)
Q
(
time
)
Q
(
rng
)
Q
(
rng
)
...
...
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