Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74d2f79

Browse files
authored
Merge pull request#94 from wnienhaus/mip_support
Add package.json for MIP package manager
2 parents25bf34e +4e2bbe4 commit74d2f79

File tree

4 files changed

+83
-3
lines changed

4 files changed

+83
-3
lines changed

‎README.rst‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ To get going run the following directly on the ESP32:
6262

6363
..code-block::python
6464
65-
# Step 1: Install micropython-esp32-ulp
6665
# IMPORTANT: Ensure the ESP32 is connected to a network with internet connectivity.
66+
67+
# Step 1: Install micropython-esp32-ulp (for MicroPython v1.20 or newer)
68+
import mip
69+
mip.install('github:micropython/micropython-esp32-ulp')
70+
71+
# Step 1: Install micropython-esp32-ulp (for MicroPython older than v1.20)
6772
import upip
6873
upip.install('micropython-esp32-ulp')
6974

‎docs/index.rst‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ Overview
1313
Installation
1414
------------
1515

16-
On the ESP32, install using upip:
16+
On the ESP32, install usingmip (orupip on older MicroPythons):
1717

1818
..code-block::python
1919
20-
# ensure the ESP32 is connected to a network with internet connectivity
20+
# step 1: ensure the ESP32 is connected to a network with internet connectivity
21+
22+
# step 2 (for MicroPython 1.20 or newer)
23+
import mip
24+
mip.install('github:micropython/micropython-esp32-ulp')
25+
26+
# step 2 (for MicroPython older than 1.20)
2127
import upip
2228
upip.install('micropython-esp32-ulp')
2329

‎package.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"v":1,
3+
"urls":[
4+
["esp32_ulp/__init__.py","github:micropython/micropython-esp32-ulp/esp32_ulp/__init__.py"],
5+
["esp32_ulp/__main__.py","github:micropython/micropython-esp32-ulp/esp32_ulp/__main__.py"],
6+
["esp32_ulp/assemble.py","github:micropython/micropython-esp32-ulp/esp32_ulp/assemble.py"],
7+
["esp32_ulp/definesdb.py","github:micropython/micropython-esp32-ulp/esp32_ulp/definesdb.py"],
8+
["esp32_ulp/link.py","github:micropython/micropython-esp32-ulp/esp32_ulp/link.py"],
9+
["esp32_ulp/nocomment.py","github:micropython/micropython-esp32-ulp/esp32_ulp/nocomment.py"],
10+
["esp32_ulp/opcodes.py","github:micropython/micropython-esp32-ulp/esp32_ulp/opcodes.py"],
11+
["esp32_ulp/opcodes_s2.py","github:micropython/micropython-esp32-ulp/esp32_ulp/opcodes_s2.py"],
12+
["esp32_ulp/parse_to_db.py","github:micropython/micropython-esp32-ulp/esp32_ulp/parse_to_db.py"],
13+
["esp32_ulp/preprocess.py","github:micropython/micropython-esp32-ulp/esp32_ulp/preprocess.py"],
14+
["esp32_ulp/soc.py","github:micropython/micropython-esp32-ulp/esp32_ulp/soc.py"],
15+
["esp32_ulp/soc_s2.py","github:micropython/micropython-esp32-ulp/esp32_ulp/soc_s2.py"],
16+
["esp32_ulp/soc_s3.py","github:micropython/micropython-esp32-ulp/esp32_ulp/soc_s3.py"],
17+
["esp32_ulp/util.py","github:micropython/micropython-esp32-ulp/esp32_ulp/util.py"]
18+
]
19+
}

‎tools/genpkgjson.py‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""
2+
Tool for generating package.json for the MIP package manager
3+
4+
Run this tool from the repo root, like:
5+
6+
python tools/genpkgjson.py > package.json
7+
8+
Note:
9+
This tool works with both python3 and micropyton.
10+
"""
11+
12+
importos
13+
importjson
14+
15+
PACKAGE_JSON_VERSION=1
16+
17+
# Update the repo when working with a fork
18+
GITHUB_REPO="micropython/micropython-esp32-ulp"
19+
20+
21+
defget_files(path):
22+
files= [f'{path}/{f}'forfinos.listdir(path)]
23+
returnfiles
24+
25+
26+
defbuild_urls(repo_base,files):
27+
return [[f,f'github:{repo_base}/{f}']forfinfiles]
28+
29+
30+
defprint_package_json(urls):
31+
"""
32+
Custom-formatting JSON output for better readability
33+
34+
json.dumps in MicroPython cannot format the output and python3
35+
puts each element of each urls' sub-arrays onto a new line.
36+
Here we print each file and its source url onto the same line.
37+
"""
38+
print('{')
39+
print(f' "v":{PACKAGE_JSON_VERSION},')
40+
print(' "urls":[')
41+
print(',\n'.join([f'{json.dumps(u)}'foruinsorted(urls)]))
42+
print(' ]')
43+
print('}')
44+
45+
46+
if__name__=='__main__':
47+
library_root='esp32_ulp'
48+
files=get_files(library_root)
49+
urls=build_urls(GITHUB_REPO,files)
50+
print_package_json(urls)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp