33 #include <pico/stdlib.h>
34 #include <hardware/i2c.h>
47 SET_DISP_START_LINE = 0x40,
50 SET_COM_OUT_DIR = 0xC0,
51 SET_DISP_OFFSET = 0xD3,
52 SET_COM_PIN_CFG = 0xDA,
53 SET_DISP_CLK_DIV = 0xD5,
55 SET_VCOM_DESEL = 0xDB,
56 SET_CHARGE_PUMP = 0x8D
86 bool ssd1306_init(
ssd1306_t *p, uint16_t width, uint16_t height, uint8_t address, i2c_inst_t *i2c_instance);
void ssd1306_bmp_show_image_with_offset(ssd1306_t *p, const uint8_t *data, const long size, uint32_t x_offset, uint32_t y_offset)
draw monochrome bitmap with offset
Definition: ssd1306.c:239
void ssd1306_poweron(ssd1306_t *p)
turn on display
Definition: ssd1306.c:126
void ssd1306_invert(ssd1306_t *p, uint8_t inv)
set invert display
Definition: ssd1306.c:135
void ssd1306_draw_char_with_font(ssd1306_t *p, uint32_t x, uint32_t y, uint32_t scale, const uint8_t *font, char c)
draw char with given font
Definition: ssd1306.c:191
void ssd1306_draw_empty_square(ssd1306_t *p, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
draw empty square at given position with given size
Definition: ssd1306.c:184
void ssd1306_draw_string(ssd1306_t *p, uint32_t x, uint32_t y, uint32_t scale, const char *s)
draw string with builtin font
Definition: ssd1306.c:221
bool ssd1306_init(ssd1306_t *p, uint16_t width, uint16_t height, uint8_t address, i2c_inst_t *i2c_instance)
initialize display
Definition: ssd1306.c:61
void ssd1306_draw_line(ssd1306_t *p, int32_t x1, int32_t y1, int32_t x2, int32_t y2)
draw pixel on buffer
Definition: ssd1306.c:155
void ssd1306_draw_char(ssd1306_t *p, uint32_t x, uint32_t y, uint32_t scale, char c)
draw char with builtin font
Definition: ssd1306.c:217
void ssd1306_draw_square(ssd1306_t *p, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
draw filled square at given position with given size
Definition: ssd1306.c:177
void ssd1306_draw_pixel(ssd1306_t *p, uint32_t x, uint32_t y)
draw pixel on buffer
Definition: ssd1306.c:149
void ssd1306_clear(ssd1306_t *p)
clear display buffer
Definition: ssd1306.c:139
void ssd1306_bmp_show_image(ssd1306_t *p, const uint8_t *data, const long size)
draw monochrome bitmap
Definition: ssd1306.c:283
void ssd1306_deinit(ssd1306_t *p)
deinitialize display
Definition: ssd1306.c:118
void ssd1306_contrast(ssd1306_t *p, uint8_t val)
set contrast of display
Definition: ssd1306.c:130
void ssd1306_poweroff(ssd1306_t *p)
turn off display
Definition: ssd1306.c:122
void ssd1306_clear_pixel(ssd1306_t *p, uint32_t x, uint32_t y)
clear pixel on buffer
Definition: ssd1306.c:143
ssd1306_command_t
defines commands used in ssd1306
Definition: ssd1306.h:39
void ssd1306_draw_string_with_font(ssd1306_t *p, uint32_t x, uint32_t y, uint32_t scale, const uint8_t *font, const char *s)
draw string with given font
Definition: ssd1306.c:211
void ssd1306_show(ssd1306_t *p)
display buffer, should be called on change
Definition: ssd1306.c:287
holds the configuration
Definition: ssd1306.h:62
uint8_t * buffer
Definition: ssd1306.h:69
uint8_t pages
Definition: ssd1306.h:65
size_t bufsize
Definition: ssd1306.h:70
i2c_inst_t * i2c_i
Definition: ssd1306.h:67
uint8_t width
Definition: ssd1306.h:63
bool external_vcc
Definition: ssd1306.h:68
uint8_t height
Definition: ssd1306.h:64
uint8_t address
Definition: ssd1306.h:66