-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved sdcard.py * Add sdcard driver * Fix sdcard on TDeck * Fix missing display instance * Add default to terminal input * Fix tdeck quit and Config save
- Loading branch information
1 parent
d57c6a4
commit 80b4e55
Showing
11 changed files
with
432 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"""This simple module configures and mounts an SDCard.""" | ||
|
||
from .mhsdcard import SDCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
"""This simple module configures and mounts an SDCard.""" | ||
|
||
# mh_if shared_sdcard_spi: | ||
from .sdcard import _SDCard | ||
# mh_end_if | ||
|
||
import machine | ||
import os | ||
|
||
|
||
|
||
_MH_SDCARD_SLOT = const(1) | ||
_MH_SDCARD_SCK = const(40) | ||
_MH_SDCARD_MISO = const(38) | ||
_MH_SDCARD_MOSI = const(41) | ||
_MH_SDCARD_CS = const(39) | ||
|
||
|
||
|
||
class SDCard: | ||
"""SDCard control.""" | ||
|
||
def __init__(self): | ||
"""Initialize the SDCard.""" | ||
# mh_if shared_sdcard_spi: | ||
self.sd = _SDCard( | ||
machine.SPI( | ||
_MH_SDCARD_SLOT, # actually SPI id | ||
sck=machine.Pin(_MH_SDCARD_SCK), | ||
miso=machine.Pin(_MH_SDCARD_MISO), | ||
mosi=machine.Pin(_MH_SDCARD_MOSI), | ||
), | ||
cs=machine.Pin(_MH_SDCARD_CS), | ||
) | ||
# mh_else: | ||
# self.sd = machine.SDCard( | ||
# slot=_MH_SDCARD_SLOT, | ||
# sck=machine.Pin(_MH_SDCARD_SCK), | ||
# miso=machine.Pin(_MH_SDCARD_MISO), | ||
# mosi=machine.Pin(_MH_SDCARD_MOSI), | ||
# cs=machine.Pin(_MH_SDCARD_CS) | ||
# ) | ||
# mh_end_if | ||
|
||
|
||
def mount(self): | ||
"""Mount the SDCard.""" | ||
if "sd" in os.listdir("/"): | ||
return | ||
try: | ||
os.mount(self.sd, '/sd') | ||
except (OSError, NameError, AttributeError) as e: | ||
print(f"Could not mount SDCard: {e}") | ||
|
||
|
||
def deinit(self): | ||
"""Unmount and deinit the SDCard.""" | ||
os.umount('/sd') | ||
# mh_if not shared_sdcard_spi: | ||
# self.sd.deinit() | ||
# mh_end_if |
Oops, something went wrong.