Code Monkey home page Code Monkey logo

micropython-ssd1351's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

micropython-ssd1351's Issues

Waveshare 1.27" RGB OLED Module 128x96

Thank you for making your work available. That must have taken some time.

I'm trying to use the new Waveshare 1.27" RGB OLED Module 128x96 ssd1351 with a Pi Pico and have got the display working. I've set the height = 96 in your driver and this allows me to draw things on the screen. The problem is that the origin appears to be 32 pixels above the top of the screen display and the bottom 32 pixels are always blank. I need to offset 32 pixels downwards.

I wonder if you can suggest how I can get the physical screen origin and the coding origin to coincide?

I am using the following GPIO pins on my Pi Pico:
spi = SPI(1, baudrate=13000000, sck=Pin(10), mosi=Pin(11))
display = Display(spi, dc=Pin(14), cs=Pin(9), rst=Pin(8))

Problem with draw_rectangle at edges of display area

from time import sleep
from ssd1351 import Display, color565
from machine import Pin, SPI

Set up display for Pi Pico

spi = SPI(1, baudrate=13000000, sck=Pin(10), mosi=Pin(11))
display = Display(spi, dc=Pin(14), cs=Pin(9), rst=Pin(8))

Define some colours

red = color565(255,0,0)
green = color565(0,255,0)
blue = color565(0,0,255)
white = color565(255,255,255)
black = 0

display.clear()
display.fill_rectangle(0,0,128,96,red) # Fill the screen red

display.draw_rectangle(0,0,128,96,green) # Problem line - Try changing 96 to 95

Turn corner pixels white - Works correctly

display.draw_pixel(0,0,white)
display.draw_pixel(0,95,white)
display.draw_pixel(127,0,white)
display.draw_pixel(127,95,white)

The fill_rectangle works as expected and reaches all edges of the screen.
However, I would expect draw_ rectangle to outline the edge pixels but it only does the top and bottom edges, the sides are not changed.
If to we change to 96 to 95 we get the edges but the bottom line is raised one pixel.

no way to rotate display

there is no way to rotate the display that I can find, the ssd1351 I am using is rotated 90 degrees clockwise, I cannot physically rotate the display

How to display a chinese character by bitmap?

for example:display "你好", I use PCtoLCD2002 change "你好" to dot matrix character like

0x08,0x80,0x08,0x80,0x08,0x80,0x11,0xFE,0x11,0x02,0x32,0x04,0x34,0x20,0x50,0x20,
0x91,0x28,0x11,0x24,0x12,0x24,0x12,0x22,0x14,0x22,0x10,0x20,0x10,0xA0,0x10,0x40,/"你",0/

0x10,0x00,0x10,0xFC,0x10,0x04,0x10,0x08,0xFC,0x10,0x24,0x20,0x24,0x20,0x25,0xFE,
0x24,0x20,0x48,0x20,0x28,0x20,0x10,0x20,0x28,0x20,0x44,0x20,0x84,0xA0,0x00,0x40,/"好",1/

and how to dispaly this? and my english not well, hope you can understand my mean... thanks

drawImage shows white noise

Hello, so I have an image (bg.raw) which i converted to raw using some png to raw converter. Now, i've used display.draw_image("bg.raw", 0, 0, 128, 128) (it's in the root dir) but the display shows white noise only. What am I doing wrong?

a way to color a sprite?

the sh1106 library lets you make "sprites" by loading data into a framebuffer using a color mode of your choice, such as this

import framebuf

RED = (255, 0, 0)

def LoadSprite(filename, width, height):
        # print(file)
        with open(filename, 'rb') as f:
            f.readline() # magic number
            f.readline() # creator comment
            f.readline() # dimensions
            data = bytearray(f.read())
        return framebuf.FrameBuffer(data, width, height, framebuf.MONO_HLSB)
        
GirlR = LoadSprite('GirlR.PBM', width=16, height=16)

and then you can display it onto the screen like this
display.blit(GirlR, 64, 35, 0, RED)

buffer, x, y, key(invisible color), color of sprite(optional)

where this is what blit is doing, which seems very similar to the "draw_sprite" except you can't select a key (invisible color) or a color to use for the sprite.

def blit(self, fbuf, x, y, key=-1, palette=None):
        super().blit(fbuf, x, y, key, palette)
        self.register_updates(y, y+self.height)

pretty much just curious how hard it would be to expand on draw_sprite to support any framebuffer color mode and drawing with the key and color selection.

I'm very new to all of this and found my sh1106 screen to be very easy to work with like this (and uses very little ram) but I really wanted to move onto a color oled!

OLED 128 x128 (ssd1351) is not displaying text

Hello
Thank you for a great OLED (ssd1351) library, examples and an excellent YouTube videos

I have a NodeMCU ESP32S development board. It has 4M Flash and 500KB of RAM
It appears to have enough RAM to run the simple python script below.
Before running the script I did a RAM memory check

import micropython
micropython.mem_info()
stack: 736 out of 15360
GC: total: 111168, used: 5136, free: 106032
No. of 1-blocks: 26, 2-blocks: 7, max blk sz: 264, max free sz: 6618

An OLED 128x128 is connected to the NodeMCU ESP32S development board. I have wired then up as per your YouTube video and your website.

Using bits of code from your examples I wrote a simple demo py script
Please see below.....

from time import sleep
from ssd1351 import Display, color565
from machine import Pin, SPI
from xglcd_font import XglcdFont

spi = SPI(2, baudrate=14500000, sck=Pin(18), mosi=Pin(23))
print('spi started')
display = Display(spi, dc=Pin(17), cs=Pin(5), rst=Pin(16))
print('display started')

display.draw_pixel(64, 64, color565(0, 255, 0))
sleep(10)
display.clear()

fixed = XglcdFont('fonts/FixedFont5x8.c', 5, 8)
x = 63 - (fixed.measure_text('Frank')//2)
print(x)
display.draw_text(x, 12, 'Frank', fixed, color565(0, 0, 255))
sleep(10)
display.clear()

display.draw_image('images/Tabby128x128.raw', 0, 0, 128, 128)
sleep(20)
display.clear()

display.fill_polygon(7, 63, 63, 50, color565(0,255,0))
sleep(10)
display.clear()

display.draw_vline(10, 0, 127, color565(0,255,255))
sleep(10)
display.clear()

display.fill_hrect(23, 50, 30, 75, color565(0,0,255))
sleep(10)
display.cleanup()

print('end of file')

The script runs without any errors. But the text part is blank and no text is displayed. The pixel, cat, polygon, line and rectangle are all displayed on the OLED but the screen is blank for the time it should be displaying text.
Could you please give me your thoughts why the text is not displaying
Thanks in advance
Frank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.