2016-05-11 19:05:08 +00:00
|
|
|
/*
|
2018-02-26 13:06:10 +00:00
|
|
|
* This file is part of the TREZOR project, https://trezor.io/
|
2016-05-11 19:05:08 +00:00
|
|
|
*
|
2018-02-26 13:06:10 +00:00
|
|
|
* Copyright (c) SatoshiLabs
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-05-11 19:05:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DISPLAY_H__
|
|
|
|
#define __DISPLAY_H__
|
|
|
|
|
2016-10-03 14:17:49 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-09-07 20:19:27 +00:00
|
|
|
// ILI9341V and ST7789V drivers both support 240px x 320px display resolution
|
|
|
|
#define MAX_DISPLAY_RESX 240
|
|
|
|
#define MAX_DISPLAY_RESY 320
|
|
|
|
// X and Y display resolution used
|
2016-09-24 14:53:43 +00:00
|
|
|
#define DISPLAY_RESX 240
|
|
|
|
#define DISPLAY_RESY 240
|
2016-05-11 19:05:08 +00:00
|
|
|
|
2017-10-11 21:05:08 +00:00
|
|
|
#define FONT_BPP 4
|
2017-12-16 13:50:28 +00:00
|
|
|
#define FONT_SIZE 20
|
2017-10-01 18:29:23 +00:00
|
|
|
|
2017-12-15 22:13:25 +00:00
|
|
|
#ifdef TREZOR_FONT_MONO_ENABLE
|
2018-06-08 12:32:55 +00:00
|
|
|
#define FONT_MONO 1
|
2017-04-28 13:54:54 +00:00
|
|
|
#endif
|
2017-12-15 22:13:25 +00:00
|
|
|
#ifdef TREZOR_FONT_NORMAL_ENABLE
|
2018-06-08 12:32:55 +00:00
|
|
|
#define FONT_NORMAL 2
|
2017-04-28 13:54:54 +00:00
|
|
|
#endif
|
2017-12-15 22:13:25 +00:00
|
|
|
#ifdef TREZOR_FONT_BOLD_ENABLE
|
2018-06-08 12:32:55 +00:00
|
|
|
#define FONT_BOLD 3
|
2017-04-28 13:54:54 +00:00
|
|
|
#endif
|
2016-09-28 16:15:06 +00:00
|
|
|
|
2017-10-17 15:31:16 +00:00
|
|
|
#define AVATAR_IMAGE_SIZE 144
|
|
|
|
#define LOADER_ICON_SIZE 64
|
2016-10-10 12:38:11 +00:00
|
|
|
|
2017-04-28 15:51:49 +00:00
|
|
|
#define RGB16(R, G, B) ((R & 0xF8) << 8) | ((G & 0xFC) << 3) | ((B & 0xF8) >> 3)
|
|
|
|
|
2017-10-17 15:31:16 +00:00
|
|
|
#define COLOR_WHITE RGB16(0xFF, 0xFF, 0xFF)
|
|
|
|
#define COLOR_BLACK RGB16(0x00, 0x00, 0x00)
|
2017-10-16 18:24:28 +00:00
|
|
|
|
2017-03-17 13:14:00 +00:00
|
|
|
// provided by port
|
|
|
|
|
2017-10-20 13:25:24 +00:00
|
|
|
void display_init(void);
|
2017-03-17 13:14:00 +00:00
|
|
|
void display_refresh(void);
|
2018-02-27 18:05:40 +00:00
|
|
|
void display_save(const char *prefix);
|
2017-03-17 13:14:00 +00:00
|
|
|
|
|
|
|
// provided by common
|
2016-05-11 19:05:08 +00:00
|
|
|
|
2016-09-28 15:00:27 +00:00
|
|
|
void display_clear(void);
|
2016-10-13 15:09:46 +00:00
|
|
|
|
|
|
|
void display_bar(int x, int y, int w, int h, uint16_t c);
|
|
|
|
void display_bar_radius(int x, int y, int w, int h, uint16_t c, uint16_t b, uint8_t r);
|
2017-03-17 13:14:00 +00:00
|
|
|
|
2016-10-13 15:09:46 +00:00
|
|
|
void display_image(int x, int y, int w, int h, const void *data, int datalen);
|
2017-09-04 20:15:30 +00:00
|
|
|
void display_avatar(int x, int y, const void *data, int datalen, uint16_t fgcolor, uint16_t bgcolor);
|
2016-10-13 15:09:46 +00:00
|
|
|
void display_icon(int x, int y, int w, int h, const void *data, int datalen, uint16_t fgcolor, uint16_t bgcolor);
|
2017-03-17 13:14:00 +00:00
|
|
|
|
2017-04-28 17:50:51 +00:00
|
|
|
#ifndef TREZOR_PRINT_DISABLE
|
|
|
|
void display_print_color(uint16_t fgcolor, uint16_t bgcolor);
|
2017-02-15 14:40:50 +00:00
|
|
|
void display_print(const char *text, int textlen);
|
2017-05-02 15:35:39 +00:00
|
|
|
void display_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
|
2017-04-28 17:50:51 +00:00
|
|
|
#endif
|
2017-03-17 13:14:00 +00:00
|
|
|
|
2018-02-06 21:54:46 +00:00
|
|
|
void display_text(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor);
|
|
|
|
void display_text_center(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor);
|
|
|
|
void display_text_right(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor);
|
2016-10-13 15:09:46 +00:00
|
|
|
int display_text_width(const char *text, int textlen, uint8_t font);
|
|
|
|
|
2017-03-17 13:14:00 +00:00
|
|
|
void display_qrcode(int x, int y, const char *data, int datalen, uint8_t scale);
|
|
|
|
void display_loader(uint16_t progress, int yoffset, uint16_t fgcolor, uint16_t bgcolor, const uint8_t *icon, uint32_t iconlen, uint16_t iconfgcolor);
|
|
|
|
|
2018-02-22 15:27:38 +00:00
|
|
|
void display_offset(int set_xy[2], int *get_x, int *get_y);
|
2017-03-17 13:14:00 +00:00
|
|
|
int display_orientation(int degrees);
|
|
|
|
int display_backlight(int val);
|
2017-10-27 04:01:22 +00:00
|
|
|
void display_fade(int start, int end, int delay);
|
2017-03-17 13:14:00 +00:00
|
|
|
|
2016-05-11 19:05:08 +00:00
|
|
|
#endif
|