parent
cd315788c8
commit
fbc486189b
10 changed files with 0 additions and 7266 deletions
|
|
@ -63,16 +63,6 @@ typedef enum
|
|||
SSD1306_ADDR_MODE_PAGE
|
||||
} ssd1306_mem_addr_mode_t;
|
||||
|
||||
/**
|
||||
* Drawing color
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OLED_COLOR_TRANSPARENT = -1, //!< Transparent (not drawing)
|
||||
OLED_COLOR_BLACK = 0, //!< Black (pixel off)
|
||||
OLED_COLOR_WHITE = 1, //!< White (or blue, yellow, pixel on)
|
||||
OLED_COLOR_INVERT = 2, //!< Invert pixel (XOR)
|
||||
} ssd1306_color_t;
|
||||
/**
|
||||
* Issue a single command on SSD1306.
|
||||
* @param dev Pointer to device descriptor
|
||||
|
|
@ -285,186 +275,6 @@ int ssd1306_set_deseltct_lvl(const ssd1306_t *dev, uint8_t lvl);
|
|||
*/
|
||||
int ssd1306_set_whole_display_lighting(const ssd1306_t *dev, bool light);
|
||||
|
||||
/**
|
||||
* Draw one pixel
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x X coordinate
|
||||
* @param y Y coordinate
|
||||
* @param color Color of the pixel
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_draw_pixel(const ssd1306_t *dev, uint8_t *fb, int8_t x, int8_t y, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a horizontal line
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x X coordinate or starting (left) point
|
||||
* @param y Y coordinate or starting (left) point
|
||||
* @param w Line width
|
||||
* @param color Color of the line
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_draw_hline(const ssd1306_t *dev, uint8_t *fb, int8_t x, int8_t y, uint8_t w, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a vertical line
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x X coordinate or starting (top) point
|
||||
* @param y Y coordinate or starting (top) point
|
||||
* @param h Line height
|
||||
* @param color Color of the line
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_draw_vline(const ssd1306_t *dev, uint8_t *fb, int8_t x, int8_t y, uint8_t h, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a line
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x0 First x point coordinate
|
||||
* @param y0 First y point coordinate
|
||||
* @param x1 Second x point coordinate
|
||||
* @param y1 Second y point coordinate
|
||||
* @param color Color of the line
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_draw_line(const ssd1306_t *dev, uint8_t *fb, int16_t x0, int16_t y0, int16_t x1, int16_t y1, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a rectangle
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x X coordinate or starting (top left) point
|
||||
* @param y Y coordinate or starting (top left) point
|
||||
* @param w Rectangle width
|
||||
* @param h Rectangle height
|
||||
* @param color Color of the rectangle border
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_draw_rectangle(const ssd1306_t *dev, uint8_t *fb, int8_t x, int8_t y, uint8_t w, uint8_t h, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a filled rectangle
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x X coordinate or starting (top left) point
|
||||
* @param y Y coordinate or starting (top left) point
|
||||
* @param w Rectangle width
|
||||
* @param h Rectangle height
|
||||
* @param color Color of the rectangle
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_fill_rectangle(const ssd1306_t *dev, uint8_t *fb, int8_t x, int8_t y, uint8_t w, uint8_t h, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a circle
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x0 X coordinate or center
|
||||
* @param y0 Y coordinate or center
|
||||
* @param r Radius
|
||||
* @param color Color of the circle border
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_draw_circle(const ssd1306_t *dev, uint8_t *fb, int8_t x0, int8_t y0, uint8_t r, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a filled circle
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x0 X coordinate or center
|
||||
* @param y0 Y coordinate or center
|
||||
* @param r Radius
|
||||
* @param color Color of the circle
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_fill_circle(const ssd1306_t *dev, uint8_t *fb, int8_t x0, int8_t y0, uint8_t r, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a triangle
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x0 First x point coordinate
|
||||
* @param y0 First y point coordinate
|
||||
* @param x1 Second x point coordinate
|
||||
* @param y1 Second y point coordinate
|
||||
* @param x2 third x point coordinate
|
||||
* @param y2 third y point coordinate
|
||||
* @param color Color of the triangle border
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_draw_triangle(const ssd1306_t *dev, uint8_t *fb, int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Draw a filled triangle
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x0 First x point coordinate
|
||||
* @param y0 First y point coordinate
|
||||
* @param x1 Second x point coordinate
|
||||
* @param y1 Second y point coordinate
|
||||
* @param x2 third x point coordinate
|
||||
* @param y2 third y point coordinate
|
||||
* @param color Color of the triangle
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_fill_triangle(const ssd1306_t *dev, uint8_t *fb, int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, ssd1306_color_t color);
|
||||
|
||||
/**
|
||||
* Select the font
|
||||
* @param idx id value of the font
|
||||
* @return Non-zero if error occured
|
||||
*/
|
||||
int ssd1306_select_font(uint8_t idx);
|
||||
|
||||
/**
|
||||
* Get the height of current selected font
|
||||
* @return Height of the font (in pixels) or 0 if none font selected
|
||||
*/
|
||||
uint8_t ssd1306_get_font_height();
|
||||
|
||||
/**
|
||||
* Get the "C" value (space between adjacent characters) of current selected font
|
||||
* @return "C" value
|
||||
*/
|
||||
uint8_t ssd1306_get_font_c();
|
||||
|
||||
/**
|
||||
* Draw one character using currently selected font
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x X position of character (top-left corner)
|
||||
* @param y Y position of character (top-left corner)
|
||||
* @param c The character to draw
|
||||
* @param foreground Character color
|
||||
* @param background Background color
|
||||
* @return Width of the character
|
||||
*/
|
||||
uint8_t ssd1306_draw_char(const ssd1306_t *dev, uint8_t *fb, uint8_t x, uint8_t y, char c, ssd1306_color_t foreground, ssd1306_color_t background);
|
||||
|
||||
/**
|
||||
* Draw one character using currently selected font
|
||||
* @param dev Pointer to device descriptor
|
||||
* @param buf Pointer to framebuffer. Framebuffer size = width * height / 8
|
||||
* @param x X position of character (top-left corner)
|
||||
* @param y Y position of character (top-left corner)
|
||||
* @param str The string to draw
|
||||
* @param foreground Character color
|
||||
* @param background Background color
|
||||
* @return Width of the string (out-of-display pixels also included)
|
||||
*/
|
||||
uint8_t ssd1306_draw_string(const ssd1306_t *dev, uint8_t *fb, uint8_t x, uint8_t y, char *str, ssd1306_color_t foreground, ssd1306_color_t background);
|
||||
|
||||
/**
|
||||
* Measure width of string with current selected font
|
||||
* @param str String to measure
|
||||
* @return Width of the string
|
||||
*/
|
||||
uint8_t ssd1306_measure_string(char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue