daschr / pico-ssd1306 Goto Github PK
View Code? Open in Web Editor NEWSimple library for using ssd1306 displays with the Raspberry Pi Pico and the pico-sdk.
License: MIT License
Simple library for using ssd1306 displays with the Raspberry Pi Pico and the pico-sdk.
License: MIT License
Can you please specify the dimensions of your tested SSD1306 display?
I seem to own a SSD1306 1.3" display and it does not work well with this library. It shows only 5-10% of the display area and the rest is just white noise
there's currently some compiler warnings, should be an easy fix to remove them
[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c: In function 'ssd1306_bmp_show_image_with_offset':
[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c:274:46: error: comparison of integer expressions of different signedness: 'uint32_t' {aka 'long unsigned int'} and 'int' [-Werror=sign-compare]
[build] 274 | for(uint32_t y=biHeight>0?biHeight-1:0; y!=border; y+=step) {
[build] | ^~
[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c:275:28: error: comparison of integer expressions of different signedness: 'uint32_t' {aka 'long unsigned int'} and 'int32_t' {aka 'const long int'} [-Werror=sign-compare]
[build] 275 | for(uint32_t x=0; x<biWidth; ++x) {
[build] | ^
[build] /home/lockbox/p/hardwarehacking-wg/badge-sdk/lib/pico-ssd1306/ssd1306.c:276:47: error: 'color_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
[build] 276 | if(((img_data[x>>3]>>(7-(x&7)))&1)==color_val)
[build] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
[build] cc1: all warnings being treated as errors
Hey,
is there a way to directly access the data stored in the framebuffer that is created in the ssd1306_init()
?
I tried printf("%d", *oled.buffer);
, but it prints zeros for me.
naming error: ssd13606_draw_empty_square instead of ssd1306_draw_empty_square !
Regards
What tool did you use to convert the BMP image to image.h format? What would be the steps to convert ones own image? In addition does your image function allow for only a partial image to be painted or must it be the entire screen? It would be nice to allow say a 20x20 image to be painted at x=25, y=30 for example.
Sometimes when i init display, clear it and want to print something, there is just static
Any solution?
I tried rendering bitmaps, but in some cases the result was inverted.
Here is an example containing the source monochrome bitmap and the generated header file: example.zip
Hi,
As the title states, are there any tools, or tips to create more fonts?
These awesome tools seem to have the wrong format but would be awesome if they could be used!
https://oleddisplay.squix.ch/
https://rop.nl/truetype2gfx/
Great library -thank you!!!
About 50% of the time I get everything written to the top line on my SSD1306 and Pico Pi.
I re-ordered your code to match the initialisation sequence in the datasheet and the problem went away.
Perhaps update the repo to reflect my changes - if you agree with them?
Thanks
// from https://github.com/makerportal/rpi-pico-ssd1306
uint8_t cmds[]= {
SET_DISP,
// timing and driving scheme
SET_DISP_CLK_DIV,
0x80,
SET_MUX_RATIO,
height - 1,
SET_DISP_OFFSET,
0x00,
// resolution and layout
SET_DISP_START_LINE,
// charge pump
SET_CHARGE_PUMP,
p->external_vcc?0x10:0x14,
SET_SEG_REMAP | 0x01, // column addr 127 mapped to SEG0
SET_COM_OUT_DIR | 0x08, // scan from COM[N] to COM0
SET_COM_PIN_CFG,
width>2*height?0x02:0x12,
// display
SET_CONTRAST,
0xcf,
SET_PRECHARGE,
p->external_vcc?0x22:0xF1,
SET_VCOM_DESEL,
0x30, // or 0x40?
SET_ENTIRE_ON, // output follows RAM contents
SET_NORM_INV, // not inverted
SET_DISP | 0x01,
// address setting
SET_MEM_ADDR,
0x00, // horizontal
};
Is there are reason why the ssd1306_deinit
function was not included in the header file? Some use cases don't require the display to be uses all the time. I was wondering if there was any reason why it was not included
It would be helpful to have the option to rotate the display by 90, 180 or 270 degrees. This way, it can easily be used in different orientations
When drawing a string with the ssd1306_draw_string_with_font()
function the 'stride' is taken from font[0], i.e. x_n+=font[0]*scale
, which is the character height rather than the width. The 'fix' should be to use font[1]
but the 8x5 font doesn't have any whitespace in the glyphs so they butt against each other (nice and compact though). A font spacing constant of one pixel can be used, e.g. x_n+=font[1]*scale+1
to work-around this. This is still two pixels per char closer together. If the current spacing was intentional it would be clearer / more reliable if it was explicit, e.g. x_n+=font[1]*scale+3
BTW: I found this while converting an 8x8 bitmap font, however this had the spacing built-in (i.e. designed to be laid next to each other) so looked quite spaced out... and a 16x8 font more so (once I had updated ssd1306_draw_char_with_font()
to handle larger chars). I am inclined to add a 'tracking' parameter to the front of the font array. The character set I am converting has the full 256 entries, so I am also inclined to add 'first char' and 'glyph count' parameters to the font array. I'd follow a standard, if I could find one :-)
Documentation says:
the first element of the array is the height
the second element of the array is the height
One of those has to be the width, right?
Hi there amazing work on this library. I was just wondering dose it support displaying custom bit arrays to display images
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.