-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.py
More file actions
37 lines (26 loc) · 871 Bytes
/
code.py
File metadata and controls
37 lines (26 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# MCU's entrypoint
# Checking if we are on CircuitPython.
import sys
if sys.implementation.name != "circuitpython":
print("ERROR: You are not using a CircuitPython-based implementation of Python !")
sys.exit(1)
# Imports
import os
import storage
import fs_blank
# CONSTANTS
MOUNTING_POINT = "/mfs"
# Code
print("Preparing the blank file system...")
fs = fs_blank.BlankMemoryFileSystem()
print("Mounting the blank file system in '{}' ...".format(MOUNTING_POINT))
storage.mount(fs, MOUNTING_POINT)
print("Checking if we can see it in the MCU's root folder:")
if MOUNTING_POINT.lstrip("/") in os.listdir("/"):
print("> It is present !")
else:
print("> It couldn't be found, exiting !")
sys.exit(2)
print("Listing of '{}': (Should be empty)".format(MOUNTING_POINT))
for element in os.listdir(MOUNTING_POINT):
print("> {}".format(element))