123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- #ifndef NRF_GFX_H__
- #define NRF_GFX_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include "sdk_errors.h"
- #include "nrf_lcd.h"
- #include "nrf_font.h"
- typedef struct
- {
- uint16_t x;
- uint16_t y;
- }nrf_gfx_point_t;
- typedef struct
- {
- uint16_t x_start;
- uint16_t y_start;
- uint16_t x_end;
- uint16_t y_end;
- uint16_t thickness;
- }nrf_gfx_line_t;
- typedef struct
- {
- uint16_t x;
- uint16_t y;
- uint16_t r;
- }nrf_gfx_circle_t;
- typedef struct
- {
- uint16_t x;
- uint16_t y;
- uint16_t width;
- uint16_t height;
- }nrf_gfx_rect_t;
- #define NRF_GFX_POINT(_x, _y) \
- { \
- .x = (_x), \
- .y = (_y) \
- }
- #define NRF_GFX_LINE(_x_0, _y_0, _x_1, _y_1, _thickness) \
- { \
- .x_start = (_x_0), \
- .y_start = (_y_0), \
- .x_end = (_x_1), \
- .y_end = (_y_1), \
- .thickness = (_thickness) \
- }
- #define NRF_GFX_CIRCLE(_x, _y, _radius) \
- { \
- .x = (_x), \
- .y = (_y), \
- .r = (_radius) \
- }
- #define NRF_GFX_RECT(_x, _y, _width, _height) \
- { \
- .x = (_x), \
- .y = (_y), \
- .width = (_width), \
- .height = (_height) \
- }
- typedef FONT_INFO nrf_gfx_font_desc_t;
- ret_code_t nrf_gfx_init(nrf_lcd_t const * p_instance);
- void nrf_gfx_uninit(nrf_lcd_t const * p_instance);
- void nrf_gfx_point_draw(nrf_lcd_t const * p_instance, nrf_gfx_point_t const * p_point, uint32_t color);
- ret_code_t nrf_gfx_line_draw(nrf_lcd_t const * p_instance, nrf_gfx_line_t const * p_line, uint32_t color);
- ret_code_t nrf_gfx_circle_draw(nrf_lcd_t const * p_instance,
- nrf_gfx_circle_t const * p_circle,
- uint32_t color,
- bool fill);
- ret_code_t nrf_gfx_rect_draw(nrf_lcd_t const * p_instance,
- nrf_gfx_rect_t const * p_rect,
- uint16_t thickness,
- uint32_t color,
- bool fill);
- void nrf_gfx_screen_fill(nrf_lcd_t const * p_instance, uint32_t color);
- ret_code_t nrf_gfx_bmp565_draw(nrf_lcd_t const * p_instance,
- nrf_gfx_rect_t const * p_rect,
- uint16_t const * img_buf);
- void nrf_gfx_background_set(nrf_lcd_t const * p_instance, uint16_t const * img_buf);
- void nrf_gfx_display(nrf_lcd_t const * p_instance);
- void nrf_gfx_rotation_set(nrf_lcd_t const * p_instance, nrf_lcd_rotation_t rotation);
- void nrf_gfx_invert(nrf_lcd_t const * p_instance, bool invert);
- ret_code_t nrf_gfx_print(nrf_lcd_t const * p_instance,
- nrf_gfx_point_t const * p_point,
- uint16_t font_color,
- const char * p_string,
- const nrf_gfx_font_desc_t * p_font,
- bool wrap);
- uint16_t nrf_gfx_height_get(nrf_lcd_t const * p_instance);
- uint16_t nrf_gfx_width_get(nrf_lcd_t const * p_instance);
- #endif
|