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
59610c40
Commit
59610c40
authored
10 years ago
by
Josef Gajdusek
Committed by
Paul Sokolovsky
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
esp8266: Add uos module
Currently implements only .uname()
parent
fabe79f7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
esp8266/Makefile
+1
-0
1 addition, 0 deletions
esp8266/Makefile
esp8266/moduos.c
+79
-0
79 additions, 0 deletions
esp8266/moduos.c
esp8266/mpconfigport.h
+4
-0
4 additions, 0 deletions
esp8266/mpconfigport.h
esp8266/qstrdefsport.h
+10
-0
10 additions, 0 deletions
esp8266/qstrdefsport.h
with
94 additions
and
0 deletions
esp8266/Makefile
+
1
−
0
View file @
59610c40
...
...
@@ -59,6 +59,7 @@ SRC_C = \
modpybrtc.c
\
modesp.c
\
modutime.c
\
moduos.c
\
utils.c
\
$(
BUILD
)
/frozen.c
\
...
...
This diff is collapsed.
Click to expand it.
esp8266/moduos.c
0 → 100644
+
79
−
0
View file @
59610c40
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Josef Gajdusek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include
<string.h>
#include
"py/mpconfig.h"
#include
"py/nlr.h"
#include
"py/obj.h"
#include
"py/objtuple.h"
#include
"py/objstr.h"
#include
"genhdr/mpversion.h"
#include
"user_interface.h"
STATIC
const
qstr
os_uname_info_fields
[]
=
{
MP_QSTR_sysname
,
MP_QSTR_nodename
,
MP_QSTR_release
,
MP_QSTR_version
,
MP_QSTR_machine
};
STATIC
const
MP_DEFINE_STR_OBJ
(
os_uname_info_sysname_obj
,
MICROPY_PY_SYS_PLATFORM
);
STATIC
const
MP_DEFINE_STR_OBJ
(
os_uname_info_nodename_obj
,
MICROPY_PY_SYS_PLATFORM
);
STATIC
const
MP_DEFINE_STR_OBJ
(
os_uname_info_version_obj
,
MICROPY_GIT_TAG
" on "
MICROPY_BUILD_DATE
);
STATIC
const
MP_DEFINE_STR_OBJ
(
os_uname_info_machine_obj
,
MICROPY_HW_BOARD_NAME
" with "
MICROPY_HW_MCU_NAME
);
STATIC
mp_obj_tuple_t
os_uname_info_obj
=
{
.
base
=
{
&
mp_type_attrtuple
},
.
len
=
5
,
.
items
=
{
(
mp_obj_t
)
&
os_uname_info_sysname_obj
,
(
mp_obj_t
)
&
os_uname_info_nodename_obj
,
NULL
,
(
mp_obj_t
)
&
os_uname_info_version_obj
,
(
mp_obj_t
)
&
os_uname_info_machine_obj
,
(
void
*
)
os_uname_info_fields
,
}
};
STATIC
mp_obj_t
os_uname
(
void
)
{
if
(
os_uname_info_obj
.
items
[
2
]
==
NULL
)
{
const
char
*
ver
=
system_get_sdk_version
();
os_uname_info_obj
.
items
[
2
]
=
mp_obj_new_str
(
ver
,
strlen
(
ver
),
false
);
}
return
(
mp_obj_t
)
&
os_uname_info_obj
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
os_uname_obj
,
os_uname
);
STATIC
const
mp_map_elem_t
os_module_globals_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___name__
),
MP_OBJ_NEW_QSTR
(
MP_QSTR_uos
)
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_uname
),
(
mp_obj_t
)
&
os_uname_obj
},
};
STATIC
MP_DEFINE_CONST_DICT
(
os_module_globals
,
os_module_globals_table
);
const
mp_obj_module_t
uos_module
=
{
.
base
=
{
&
mp_type_module
},
.
name
=
MP_QSTR_uos
,
.
globals
=
(
mp_obj_dict_t
*
)
&
os_module_globals
,
};
This diff is collapsed.
Click to expand it.
esp8266/mpconfigport.h
+
4
−
0
View file @
59610c40
...
...
@@ -66,14 +66,17 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
extern
const
struct
_mp_obj_module_t
pyb_module
;
extern
const
struct
_mp_obj_module_t
esp_module
;
extern
const
struct
_mp_obj_module_t
utime_module
;
extern
const
struct
_mp_obj_module_t
uos_module
;
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_esp), (mp_obj_t)&esp_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&utime_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&uos_module }, \
#define MP_STATE_PORT MP_STATE_VM
...
...
@@ -92,3 +95,4 @@ extern const struct _mp_obj_module_t utime_module;
#define MICROPY_HAL_H "esp_mphal.h"
#define MICROPY_HW_BOARD_NAME "ESP module"
#define MICROPY_HW_MCU_NAME "ESP8266"
#define MICROPY_PY_SYS_PLATFORM "ESP8266"
This diff is collapsed.
Click to expand it.
esp8266/qstrdefsport.h
+
10
−
0
View file @
59610c40
...
...
@@ -41,6 +41,16 @@ Q(udelay)
Q
(
sync
)
Q
(
hard_reset
)
// uos module
Q
(
uos
)
Q
(
os
)
Q
(
uname
)
Q
(
sysname
)
Q
(
nodename
)
Q
(
release
)
Q
(
version
)
Q
(
machine
)
Q
(
esp
)
Q
(
socket
)
Q
(
connect
)
...
...
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