2016-05-11 19:05:08 +00:00
|
|
|
/*
|
2019-06-17 18:27:55 +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__
|
|
|
|
|
2019-04-23 17:15:42 +00:00
|
|
|
#include <stdbool.h>
|
2022-03-05 17:50:49 +00:00
|
|
|
#include <stddef.h>
|
2019-05-10 14:23:18 +00:00
|
|
|
#include <stdint.h>
|
2016-10-03 14:17:49 +00:00
|
|
|
|
2022-08-16 14:51:10 +00:00
|
|
|
#include "buffers.h"
|
|
|
|
#include "colors.h"
|
2022-10-14 10:43:37 +00:00
|
|
|
#include TREZOR_BOARD
|
2022-08-16 14:51:10 +00:00
|
|
|
#include "display_interface.h"
|
2022-08-18 13:12:02 +00:00
|
|
|
#include "fonts/fonts.h"
|
2018-09-12 13:23:30 +00:00
|
|
|
|
2022-08-16 14:51:10 +00:00
|
|
|
typedef enum {
|
|
|
|
TOIF_FULL_COLOR_BE = 0, // big endian
|
|
|
|
TOIF_GRAYSCALE_OH = 1, // odd hi
|
|
|
|
TOIF_FULL_COLOR_LE = 2, // little endian
|
|
|
|
TOIF_GRAYSCALE_EH = 3, // even hi
|
|
|
|
} toif_format_t;
|
2017-10-01 18:29:23 +00:00
|
|
|
|
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);
|
2020-08-21 10:00:42 +00:00
|
|
|
bool display_toif_info(const uint8_t *buf, uint32_t len, uint16_t *out_w,
|
2022-08-16 14:51:10 +00:00
|
|
|
uint16_t *out_h, toif_format_t *out_format);
|
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);
|
2019-03-29 15:26:02 +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
|
|
|
|
2019-03-29 15:26:02 +00:00
|
|
|
void display_text(int x, int y, const char *text, int textlen, int font,
|
|
|
|
uint16_t fgcolor, uint16_t bgcolor);
|
|
|
|
void display_text_center(int x, int y, const char *text, int textlen, int font,
|
|
|
|
uint16_t fgcolor, uint16_t bgcolor);
|
|
|
|
void display_text_right(int x, int y, const char *text, int textlen, int font,
|
|
|
|
uint16_t fgcolor, uint16_t bgcolor);
|
2018-08-16 19:16:34 +00:00
|
|
|
int display_text_width(const char *text, int textlen, int font);
|
2020-02-19 20:42:12 +00:00
|
|
|
int display_text_split(const char *text, int textlen, int font,
|
|
|
|
int requested_width);
|
2022-08-16 14:51:10 +00:00
|
|
|
void display_text_render_buffer(const char *text, int textlen, int font,
|
|
|
|
buffer_text_t *buffer, int text_offset);
|
2016-10-13 15:09:46 +00:00
|
|
|
|
2022-05-17 11:41:20 +00:00
|
|
|
void display_qrcode(int x, int y, const char *data, uint8_t scale);
|
2017-03-17 13:14:00 +00:00
|
|
|
|
2018-02-22 15:27:38 +00:00
|
|
|
void display_offset(int set_xy[2], int *get_x, int *get_y);
|
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
|
|
|
|
2020-11-14 22:46:13 +00:00
|
|
|
// helper for locating a substring in buffer with utf-8 string
|
|
|
|
void display_utf8_substr(const char *buf_start, size_t buf_len, int char_off,
|
|
|
|
int char_len, const char **out_start, int *out_len);
|
|
|
|
|
2016-05-11 19:05:08 +00:00
|
|
|
#endif
|