Fix screen refresh
This commit is contained in:
parent
ef0bb65fdf
commit
6db323c570
2 changed files with 85 additions and 54 deletions
32
lib_sharp.h
32
lib_sharp.h
|
@ -1,30 +1,36 @@
|
|||
#ifndef LIB_SHARP_H
|
||||
#define LIB_SHARP_H
|
||||
#ifndef SHARP_DISPLAY
|
||||
#define SHARP_DISPLAY
|
||||
|
||||
#include "hardware/spi.h"
|
||||
|
||||
#define CMD_WRITE 0x80
|
||||
#define CMD_CLEAR 0x20
|
||||
#define CMD_VCOM 0x40
|
||||
// in LSB format
|
||||
#define CMD_WRITE 0b10000000
|
||||
#define CMD_VCOM 0b01000000
|
||||
#define CMD_CLEAR 0b00100000
|
||||
|
||||
#define SWAP(a, b) { a ^= b; b ^= a; a ^= b; }
|
||||
typedef enum sharp_color
|
||||
{
|
||||
WHITE = 0,
|
||||
BLACK = 1,
|
||||
}
|
||||
sharp_color_t;
|
||||
|
||||
typedef struct sharp_display {
|
||||
typedef struct sharp_display
|
||||
{
|
||||
uint16_t width, height;
|
||||
uint8_t cs;
|
||||
uint8_t vcom;
|
||||
uint8_t * framebuffer;
|
||||
spi_inst_t * spi;
|
||||
} sharp_display_t;
|
||||
}
|
||||
sharp_display_t;
|
||||
|
||||
sharp_display_t sharp_display_new(uint16_t width, uint16_t height, spi_inst_t * spi, uint8_t cs);
|
||||
bool sharp_display_error(sharp_display_t * display);
|
||||
void sharp_display_refresh_screen(sharp_display_t * display);
|
||||
void sharp_display_clear_screen(sharp_display_t * display);
|
||||
void sharp_display_clear_buffer(sharp_display_t * display);
|
||||
void sharp_display_toggle_vcom(sharp_display_t * display);
|
||||
void sharp_display_draw_pixel(sharp_display_t *display, uint16_t x, uint16_t y, sharp_color_t color);
|
||||
void sharp_display_fill_screen(sharp_display_t * display, sharp_color_t color);
|
||||
|
||||
void sharp_display_draw_pixel(sharp_display_t *display, int x, int y, bool color);
|
||||
void sharp_display_draw_circle(sharp_display_t *display, int x0, int y0, int radius, bool color);
|
||||
|
||||
#endif //LIB_SHARP_H
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue