This repository has been archived by the owner on Apr 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,162 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{label="OpenPython OS", reboot=true, setlabel=true, setboot=true} |
16 changes: 0 additions & 16 deletions
16
src/main/resources/assets/openpython/opos/boot/01_basic.py
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 |
---|---|---|
@@ -1,23 +1,7 @@ | ||
import machine | ||
|
||
import event | ||
import value | ||
|
||
buf = [] | ||
|
||
|
||
@machine.hook_stdin | ||
def input_handler(): | ||
while not buf: | ||
event.wait(10) | ||
|
||
return int(buf.pop(0)) | ||
|
||
|
||
@event.register("key_down") | ||
def handle_key_down(_0, _1, char, *_): | ||
buf.append(char) | ||
|
||
|
||
event.setup() | ||
value.setup() |
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 @@ | ||
import value | ||
|
||
value.setup() |
20 changes: 20 additions & 0 deletions
20
src/main/resources/assets/openpython/opos/boot/04_builtin.py
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
File renamed without changes.
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 was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
44 changes: 44 additions & 0 deletions
44
src/main/resources/assets/openpython/opos/lib/openos/colors.py
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,44 @@ | ||
# https://github.com/MightyPirates/OpenComputers/blob/master-MC1.12/ | ||
# - src/main/resources/assets/opencomputers/loot/openos/lib/colors.lua | ||
|
||
from micropython import const | ||
|
||
__all__ = ["WHITE", "ORANGE", "MAGENTA", "LIGHTBLUE", | ||
"YELLOW", "LIME", "PINK", "GRAY", | ||
"SILVER", "CYAN", "PURPLE", "BLUE", | ||
"BROWN", "GREEN", "RED", "BLACK"] | ||
|
||
WHITE = const(0) | ||
ORANGE = const(1) | ||
MAGENTA = const(2) | ||
LIGHTBLUE = const(3) | ||
YELLOW = const(4) | ||
LIME = const(5) | ||
PINK = const(6) | ||
GRAY = const(7) | ||
SILVER = const(8) | ||
CYAN = const(9) | ||
PURPLE = const(10) | ||
BLUE = const(11) | ||
BROWN = const(12) | ||
GREEN = const(13) | ||
RED = const(14) | ||
BLACK = const(15) | ||
|
||
# alias | ||
white = WHITE | ||
orange = ORANGE | ||
magenta = MAGENTA | ||
lightblue = LIGHTBLUE | ||
yellow = YELLOW | ||
lime = LIME | ||
pink = PINK | ||
gray = GRAY | ||
silver = SILVER | ||
cyan = CYAN | ||
purple = PURPLE | ||
blue = BLUE | ||
brown = BROWN | ||
green = GREEN | ||
red = RED | ||
black = BLACK |
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
21 changes: 21 additions & 0 deletions
21
src/main/resources/assets/openpython/opos/lib/openos/computer.py
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,21 @@ | ||
# noinspection PyUnresolvedReferences | ||
from ucomputer import * | ||
import ucomputer | ||
import utime | ||
|
||
|
||
def address(): | ||
return ucomputer.get_computer_address() | ||
|
||
|
||
def uptime(): | ||
return utime.time_up() | ||
|
||
|
||
def pull_signal(seconds): | ||
signal = ucomputer.pop_signal(int(seconds * 20)) | ||
if signal is None: | ||
return None | ||
|
||
name, args = signal | ||
return (name,) + args |
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 @@ | ||
raise NotImplementedError |
Oops, something went wrong.