2022-12-16 20:53:16 +00:00
|
|
|
'''
|
|
|
|
buttons.py
|
2023-01-30 10:19:28 +00:00
|
|
|
Push either switch A, switch B or the BOOT switch (in the case of the non-w version) to change the display
|
2022-12-16 20:53:16 +00:00
|
|
|
'''
|
|
|
|
import interstate75
|
|
|
|
|
|
|
|
i75 = interstate75.Interstate75(display=interstate75.DISPLAY_INTERSTATE75_32X32)
|
|
|
|
graphics = i75.display
|
|
|
|
|
|
|
|
width = i75.width
|
|
|
|
height = i75.height
|
|
|
|
|
|
|
|
A_COLOR = graphics.create_pen(0x31, 0x81, 0xCE)
|
|
|
|
A_TEXT = graphics.create_pen(0xCE, 0x7E, 0x31)
|
|
|
|
|
|
|
|
B_COLOR = graphics.create_pen(0xC3, 0x3C, 0xBD)
|
|
|
|
B_TEXT = graphics.create_pen(0x3C, 0xC3, 0x42)
|
|
|
|
|
2023-01-30 10:19:28 +00:00
|
|
|
BOOT_COLOR = graphics.create_pen(0xC3, 0x3C, 0xBD)
|
|
|
|
BOOT_TEXT = graphics.create_pen(0x3C, 0xC3, 0x42)
|
|
|
|
|
2022-12-16 20:53:16 +00:00
|
|
|
BG = graphics.create_pen(0xC1, 0x99, 0x3E)
|
|
|
|
|
|
|
|
|
|
|
|
def display_a():
|
|
|
|
graphics.set_pen(A_COLOR)
|
|
|
|
graphics.clear()
|
|
|
|
graphics.set_pen(A_TEXT)
|
|
|
|
graphics.text("A", 8, 6, False, 3)
|
|
|
|
i75.update()
|
|
|
|
|
|
|
|
|
2023-01-30 10:19:28 +00:00
|
|
|
def display_boot():
|
|
|
|
graphics.set_pen(BOOT_COLOR)
|
|
|
|
graphics.clear()
|
|
|
|
graphics.set_pen(BOOT_TEXT)
|
2023-01-30 10:48:04 +00:00
|
|
|
graphics.text("BOOT", 5, 11, False, 1)
|
2023-01-30 10:19:28 +00:00
|
|
|
i75.update()
|
|
|
|
|
|
|
|
|
2022-12-16 20:53:16 +00:00
|
|
|
graphics.set_pen(BG)
|
|
|
|
graphics.clear()
|
|
|
|
i75.update()
|
|
|
|
|
|
|
|
while 1:
|
|
|
|
if i75.switch_pressed(interstate75.SWITCH_A):
|
|
|
|
display_a()
|
2023-01-30 10:19:28 +00:00
|
|
|
if i75.switch_pressed(interstate75.SWITCH_BOOT):
|
|
|
|
display_boot()
|