コード例 #1
0
def draw():
    """Provide a RGB565 drawing surface.

    Currently most of the draw565 functions will not work since we haven't
    mocked up the display. This limits the testing that we can perform.
    """
    d = draw565.Draw565(None)

    return d
コード例 #2
0
ファイル: watch.py プロジェクト: pointbre/wasp-os
    def get_time(self):
        now = self.get_localtime()
        return (now[3], now[4], now[5])

    @property
    def uptime(self):
        return time.time() - self._epoch

    def get_uptime_ms(self):
        return int(self.uptime * 1000)


backlight = Backlight()
spi = SPI(0)
spi.init(polarity=1, phase=1, baudrate=8000000)
display = ST7789_SPI(240,
                     240,
                     spi,
                     cs=Pin("DISP_CS", Pin.OUT, quiet=True),
                     dc=Pin("DISP_DC", Pin.OUT, quiet=True),
                     res=Pin("DISP_RST", Pin.OUT, quiet=True))
drawable = draw565.Draw565(display)

accel = Accelerometer()
battery = Battery()
button = Pin('BUTTON', Pin.IN, quiet=True)
rtc = RTC()
touch = CST816S(I2C(0), Pin('TP_INT', Pin.IN, quiet=True),
                Pin('TP_RST', Pin.OUT, quiet=True))
vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True)
コード例 #3
0
ファイル: demo.py プロジェクト: mulm/wasp-os
colors = (
    0xffff,
    0xf800,  # red
    0xffff,
    0xffe0,  # yellow
    0xffff,
    0x07e0,  # green
    0xffff,
    0x07ff,  # cyan
    0xffff,
    0x001f,  # blue
    0xffff,
    0xf81f,  # magenta
)

draw = draw565.Draw565(watch.display)


def textdemo():
    watch.display.fill(0)
    draw.string("The quick brown", 12, 24)
    draw.string("fox jumped over", 12, 48)
    draw.string("the lazy dog.", 12, 72)
    time.sleep(2)
    draw.string("0123456789", 12, 120)
    draw.string('!"£$%^&*()', 12, 144)
    time.sleep(3)


def run():
    l = logo.pine64