-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from mchilli/flip-rotation
flip rotation, brightness setting
- Loading branch information
Showing
4 changed files
with
116 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
import microcontroller | ||
import supervisor | ||
from adafruit_macropad import MacroPad | ||
|
||
USBENABLEDFILE = "usbenabled" | ||
|
||
class System(): | ||
def enable_usb(macropad:MacroPad=None) -> None: | ||
def enable_usb(app=None) -> None: | ||
try: | ||
with open(USBENABLEDFILE, "a") as f: pass | ||
System.hard_reset() | ||
except Exception: | ||
pass | ||
|
||
def soft_reset(macropad:MacroPad=None) -> None: | ||
def soft_reset(app=None) -> None: | ||
supervisor.reload() | ||
|
||
def hard_reset(macropad:MacroPad=None) -> None: | ||
def hard_reset(app=None) -> None: | ||
microcontroller.reset() | ||
|
||
def decrease_brightness(macropad:MacroPad=None) -> None: | ||
if macropad.display.brightness > 0: | ||
brightness = round(macropad.display.brightness * 10) | ||
macropad.display.brightness = (brightness - 1) / 10 | ||
macropad.pixels.brightness = (brightness - 1) / 10 | ||
macropad.pixels.show() | ||
def decrease_brightness(app=None) -> None: | ||
if app.macropad.display.brightness > 0: | ||
brightness = (round(app.macropad.display.brightness * 10) - 1) / 10 | ||
app.macropad.display.brightness = brightness | ||
app.macropad.pixels.brightness = brightness | ||
app.macropad.pixels.show() | ||
app.settings["brightness"] = brightness | ||
|
||
def increase_brightness(macropad:MacroPad=None) -> None: | ||
if macropad.display.brightness < 1: | ||
brightness = round(macropad.display.brightness * 10) | ||
macropad.display.brightness = (brightness + 1) / 10 | ||
macropad.pixels.brightness = (brightness + 1) / 10 | ||
macropad.pixels.show() | ||
def increase_brightness(app=None) -> None: | ||
if app.macropad.display.brightness < 1: | ||
brightness = (round(app.macropad.display.brightness * 10) + 1) / 10 | ||
app.macropad.display.brightness = brightness | ||
app.macropad.pixels.brightness = brightness | ||
app.macropad.pixels.show() | ||
app.settings["brightness"] = brightness |
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