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
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
7378c50b
Commit
7378c50b
authored
9 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
esp8266: Move wifi_mode() and phy_mode() to network module.
parent
9e8396ac
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
esp8266/modesp.c
+0
-22
0 additions, 22 deletions
esp8266/modesp.c
esp8266/modnetwork.c
+22
-0
22 additions, 0 deletions
esp8266/modnetwork.c
with
22 additions
and
22 deletions
esp8266/modesp.c
+
0
−
22
View file @
7378c50b
...
@@ -512,26 +512,6 @@ void error_check(bool status, const char *msg) {
...
@@ -512,26 +512,6 @@ void error_check(bool status, const char *msg) {
}
}
}
}
STATIC
mp_obj_t
esp_wifi_mode
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
if
(
n_args
==
0
)
{
return
mp_obj_new_int
(
wifi_get_opmode
());
}
else
{
wifi_set_opmode
(
mp_obj_get_int
(
args
[
0
]));
return
mp_const_none
;
}
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
esp_wifi_mode_obj
,
0
,
1
,
esp_wifi_mode
);
STATIC
mp_obj_t
esp_phy_mode
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
if
(
n_args
==
0
)
{
return
mp_obj_new_int
(
wifi_get_phy_mode
());
}
else
{
wifi_set_phy_mode
(
mp_obj_get_int
(
args
[
0
]));
return
mp_const_none
;
}
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
esp_phy_mode_obj
,
0
,
1
,
esp_phy_mode
);
STATIC
mp_obj_t
esp_sleep_type
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
STATIC
mp_obj_t
esp_sleep_type
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
if
(
n_args
==
0
)
{
if
(
n_args
==
0
)
{
return
mp_obj_new_int
(
wifi_get_sleep_type
());
return
mp_obj_new_int
(
wifi_get_sleep_type
());
...
@@ -596,8 +576,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
...
@@ -596,8 +576,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_flash_erase_obj, esp_flash_erase);
STATIC
const
mp_map_elem_t
esp_module_globals_table
[]
=
{
STATIC
const
mp_map_elem_t
esp_module_globals_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_esp
)
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_esp
)
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_wifi_mode
),
(
mp_obj_t
)
&
esp_wifi_mode_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_phy_mode
),
(
mp_obj_t
)
&
esp_phy_mode_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_sleep_type
),
(
mp_obj_t
)
&
esp_sleep_type_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_sleep_type
),
(
mp_obj_t
)
&
esp_sleep_type_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_deepsleep
),
(
mp_obj_t
)
&
esp_deepsleep_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_deepsleep
),
(
mp_obj_t
)
&
esp_deepsleep_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_flash_id
),
(
mp_obj_t
)
&
esp_flash_id_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_flash_id
),
(
mp_obj_t
)
&
esp_flash_id_obj
},
...
...
This diff is collapsed.
Click to expand it.
esp8266/modnetwork.c
+
22
−
0
View file @
7378c50b
...
@@ -203,9 +203,31 @@ const mp_obj_type_t wlan_if_type = {
...
@@ -203,9 +203,31 @@ const mp_obj_type_t wlan_if_type = {
.
locals_dict
=
(
mp_obj_t
)
&
wlan_if_locals_dict
,
.
locals_dict
=
(
mp_obj_t
)
&
wlan_if_locals_dict
,
};
};
STATIC
mp_obj_t
esp_wifi_mode
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
if
(
n_args
==
0
)
{
return
mp_obj_new_int
(
wifi_get_opmode
());
}
else
{
wifi_set_opmode
(
mp_obj_get_int
(
args
[
0
]));
return
mp_const_none
;
}
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
esp_wifi_mode_obj
,
0
,
1
,
esp_wifi_mode
);
STATIC
mp_obj_t
esp_phy_mode
(
mp_uint_t
n_args
,
const
mp_obj_t
*
args
)
{
if
(
n_args
==
0
)
{
return
mp_obj_new_int
(
wifi_get_phy_mode
());
}
else
{
wifi_set_phy_mode
(
mp_obj_get_int
(
args
[
0
]));
return
mp_const_none
;
}
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
esp_phy_mode_obj
,
0
,
1
,
esp_phy_mode
);
STATIC
const
mp_map_elem_t
mp_module_network_globals_table
[]
=
{
STATIC
const
mp_map_elem_t
mp_module_network_globals_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_network
)
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_network
)
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_WLAN
),
(
mp_obj_t
)
&
get_wlan_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_WLAN
),
(
mp_obj_t
)
&
get_wlan_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_wifi_mode
),
(
mp_obj_t
)
&
esp_wifi_mode_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_phy_mode
),
(
mp_obj_t
)
&
esp_phy_mode_obj
},
#if MODNETWORK_INCLUDE_CONSTANTS
#if MODNETWORK_INCLUDE_CONSTANTS
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_STAT_IDLE
),
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_STAT_IDLE
),
...
...
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