Beispiel #1
0
    def __init__(self):
        spi = SPI(mosi=Pin(23), miso=Pin(19), sck=Pin(18), polarity=1, phase=1)
        self.display = ssd1331.SSD1331(spi, dc=Pin(32), cs=Pin(5), rst=Pin(33))
        self.display.fill(0x0000)

        ### global buffer ###
        self.dispWidth = self.display.width
        self.dispHeight = self.display.height

        # ALL_buffer #
        self.global__buffer = bytearray(self.display.width *
                                        self.display.height * 2)
        self.global___frame__buffer = framebuf.FrameBuffer(
            self.global__buffer, self.display.width, self.display.height,
            framebuf.RGB565)
Beispiel #2
0
          send_image(target)
    
        except:
          send_image(IMAGE_ERROR)
          raise

        utime.sleep(DEFAULT_SLEEP)


###プログラムはここから動くよ

#SDカードやディスプレイが接続されるシリアルバスの初期化
spi = SPI(1, baudrate=26000000, polarity=1, phase=1, sck=Pin(18), mosi=Pin(17), miso=Pin(19))

#ディスプレイの初期化
display = ssd1331.SSD1331(spi, dc=Pin(12), cs=Pin(15), rst=Pin(16))

#SDカードを準備
try:
  sd = sdcard.SDCard(spi, Pin(5))
  uos.mount(sd, SD_MOUNT_PATH)
  uos.chdir(SD_MOUNT_PATH)
except:
  #SDカードの準備に失敗したら、エラー画面出すよ
  send_image(SD_ERROR)
  raise

#画像定義ファイルステータスが
try:
  uos.stat(CONFIG_FILE)
  #所得できたら定義ファイルから画像を表示するメソッドを実行
Beispiel #3
0
#import network
#station = network.WLAN(network.STA_IF)
#station.active(True)
#station.connect("monessid","monpassword")
from machine import Pin, SPI
import ssd1331
import FreeMono
spi = SPI(1, baudrate=4000000, mosi=Pin(13), sck=Pin(14), miso=Pin(12))
oled = ssd1331.SSD1331(spi,
                       cs=Pin(15, Pin.OUT),
                       dc=Pin(27, Pin.OUT),
                       rst=Pin(26, Pin.OUT))
oled.fill()
oled.fill()
oled.setFont(FreeMono.FreeMono12pt8b())
oled.putText(0, 20, "Bonne", 0xf800)
oled.putText(0, 40, b'ann\xc3\xa9e'.decode("utf-8"), 0x1f)
oled.putText(0, 60, b'\xc3\xa0 tous'.decode("utf-8"), 0x7e0)

Beispiel #4
0
 def _device_init(self):
     GPIO.setwarnings(False)
     SSD1331_PIN_CS  = 23
     SSD1331_PIN_DC  = 24
     SSD1331_PIN_RST = 25
     return ssd1331.SSD1331(SSD1331_PIN_DC, SSD1331_PIN_RST, SSD1331_PIN_CS)
Beispiel #5
0
# bitmap rgb565 images
import levelFrame
import dot21

# spi initialisation
spi = SPI(0, baudrate=6000000, sck=Pin(6), mosi=Pin(7))
dc = Pin(2, Pin.OUT)
cs = Pin(3, Pin.OUT)

# oled initialisation
width = 96
height = 64
oled = ssd1331.SSD1331(spi=spi,
                       dc=Pin(2),
                       cs=Pin(3),
                       width=width,
                       height=height)
oled.fill(0)

# frame buffer initialisation

screenArray = bytearray(oled.width * oled.height * 2)
screenFb = framebuf.FrameBuffer(screenArray, oled.width, oled.height,
                                framebuf.RGB565)
screenFb.fill(0)

# build bubble screen

BubbleLevel = levelFrame.levelFrame()