示例#1
0
def shift_in_from_bottom(image):
    """
    Creates an animation where "image" is shifted from bottom
    of the display up in to the center of the display.
    """
    for i in reversed(range(DISPLAY_WIDTH + 1)):
        yield Image.shift_down(image, i)
示例#2
0
def shift_in_from_top(image):
    """
    Creates an animation where "image" is shifted from top
    of the display down in to the center of the display.
    """
    for i in reversed(range(DISPLAY_WIDTH + 1)):
        yield Image.shift_up(image, i)
示例#3
0
def shift_in_from_right(image):
    """
    Creates an animation where "image" is shifted from right
    of the display and in to the center of the display.
    """
    for i in reversed(range(DISPLAY_WIDTH + 1)):
        yield Image.shift_right(image, i)
示例#4
0
def shift_out_to_bottom(image):
    """
    Creates an animation where "image" is shifted from center
    of display out of the screen downwards.
    """
    for i in range(DISPLAY_WIDTH + 1):
        yield Image.shift_down(image, i)
示例#5
0
def shift_out_to_right(image):
    """
    Creates an animation where "image" is shifted from center
    of display out of the screen to the right.
    """
    for i in range(DISPLAY_WIDTH + 1):
        yield Image.shift_right(image, i)
示例#6
0
from hub import Image
import struct
from utime import sleep_ms
from micropython import const, schedule
import ubluetooth

CONNECT_IMAGES = [
    Image('03579:00000:00000:00000:00000'),
    Image('00357:00000:00000:00000:00000'),
    Image('00035:00000:00000:00000:00000'),
    Image('00003:00000:00000:00000:00000'),
    Image('00000:00000:00000:00000:00009'),
    Image('00000:00000:00000:00000:00097'),
    Image('00000:00000:00000:00000:00975'),
    Image('00000:00000:00000:00000:09753'),
    Image('00000:00000:00000:00000:97530'),
    Image('00000:00000:00000:00000:75300'),
    Image('00000:00000:00000:00000:53000'),
    Image('90000:00000:00000:00000:30000'),
    Image('79000:00000:00000:00000:00000'),
    Image('57900:00000:00000:00000:00000'),
    Image('35790:00000:00000:00000:00000'),
]

_IRQ_CENTRAL_CONNECT = const(1)
_IRQ_CENTRAL_DISCONNECT = const(2)

_NOTIFY_ENABLE = const(1)
_INDICATE_ENABLE = const(2)

if 'FLAG_INDICATE' in dir(ubluetooth):
示例#7
0
 def set_logo(self, logo_str):
     self.logo=Image(logo_str)
     self._CONNECT_ANIMATION = [img + self.logo for img in CONNECT_IMAGES]
示例#8
0
_UART_UUID = _UART_SERVICE_UUID
_UART_TX = (
    _UART_TX_CHAR_UUID,
    _FLAG_READ | _FLAG_NOTIFY,
)
_UART_RX = (
    _UART_RX_CHAR_UUID,
    _FLAG_WRITE | _FLAG_WRITE_NO_RESPONSE,
)
_UART_SERVICE = (
    _UART_UUID,
    (_UART_TX, _UART_RX),
)

_CONNECT_IMG_1 = Image('00000:09000:09000:09000:00000')
_CONNECT_IMG_2 = Image('00000:00900:00900:00900:00000')
_CONNECT_IMG_3 = Image('00000:00090:00090:00090:00000')

_COMPLETE_IMG = Image('00000:05550:05950:05550:00000')

_CONNECT_PARENT_SEARCH_IMG = Image('00055:00005:00005:00005:00055')
_CONNECT_CHILDREN_SEARCH_IMG = Image('55000:50000:50000:50000:55000')

_CONNECT_PARENT_FOUND_IMG = Image('00099:00009:00009:00009:00099')
_CONNECT_CHILDREN_FOUND_IMG = Image('99000:90000:90000:90000:99000')

_CONNECT_ANIMATION_P_S = [
    _CONNECT_IMG_1 + _CONNECT_PARENT_SEARCH_IMG,
    _CONNECT_IMG_2 + _CONNECT_PARENT_SEARCH_IMG,
    _CONNECT_IMG_3 + _CONNECT_PARENT_SEARCH_IMG
示例#9
0

LONG_PRESS_MS = 3000


class Sounds(object):
    NAVIGATION = "sounds/Flipper_Navigation_LeftClick"
    NAVIGATION_FAST = "sounds/Flipper_FastBack"
    PROGRAM_START = "sounds/Flipper_RunningProgram_Start"
    PROGRAM_STOP = "sounds/Flipper_Stop_Program"
    STARTUP = "sounds/Flipper_StartUp"
    SHUTDOWN = "sounds/Flipper_ShutDown"


IMAGE_NUMBERS = (
    Image('09990:09090:09090:09090:09990'),  # 0
    Image('00900:00900:00900:00900:00900'),  # 1
    Image('09990:00090:09990:09000:09990'),  # 2
    Image('09990:00090:09990:00090:09990'),  # 3
    Image('09090:09090:09990:00090:00090'),  # 4
    Image('09990:09000:09990:00090:09990'),  # 5
    Image('09990:09000:09990:09090:09990'),  # 6
    Image('09990:00090:00990:00090:00090'),  # 7
    Image('09990:09090:09990:09090:09990'),  # 8
    Image('09990:09090:09990:00090:00990'),  # 9
    Image('90999:90909:90909:90909:90999'),  # 10
    Image('90090:90090:90090:90090:90090'),  # 11
    Image('90999:90009:90999:90900:90999'),  # 12
    Image('90999:90009:90999:90009:90999'),  # 13
    Image('90909:90909:90999:90009:90009'),  # 14
    Image('90999:90900:90999:90009:90999'),  # 15
示例#10
0
sleep(0.5)

# Set the display rotation, this can be 0, 90, 180, 270.
display.show(Image.GO_UP)
sleep(0.5)
display.rotation(90)
sleep(0.5)
display.rotation(90)
sleep(0.5)
display.rotation(90)
sleep(0.5)
display.rotation(90)

sleep(0.5)

# Show an animation.
animation = [
    Image("09090:99999:99999:09990:00900"),
    Image("01010:11111:11111:01110:00100"),
    Image("09090:99999:99999:09990:00900"),
    Image("01010:11111:11111:01110:00100")
]
display.show(animation, fade=2, clear=False, delay=500)

sleep(0.5)

# Restore the initial display.
display.clear()
display.show(Image(current_display), fade=0, clear=False, delay=500)