1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-15 09:02:02 +00:00

refactor(core/embed): introduce display_utils.c

[no changelog]
This commit is contained in:
cepetr 2024-01-17 15:29:49 +01:00 committed by cepetr
parent cc6ed93b32
commit 3b9dd55788
15 changed files with 67 additions and 11 deletions

View File

@ -58,6 +58,7 @@ CPPPATH_MOD += [
]
SOURCE_MOD += [
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/colors.c',
'embed/lib/fonts/fonts.c',
'embed/lib/fonts/font_bitmap.c',

View File

@ -84,6 +84,7 @@ SOURCE_MOD += [
'embed/lib/buffers.c',
'embed/lib/colors.c',
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/fonts/fonts.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/image.c',

View File

@ -75,6 +75,7 @@ CPPPATH_MOD += [
]
SOURCE_MOD += [
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/terminal.c',
'embed/lib/colors.c',
'embed/lib/fonts/fonts.c',

View File

@ -81,6 +81,7 @@ SOURCE_MOD += [
'embed/lib/buffers.c',
'embed/lib/colors.c',
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/fonts/fonts.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/image.c',

View File

@ -191,6 +191,7 @@ SOURCE_MOD += [
'embed/lib/buffers.c',
'embed/lib/colors.c',
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/fonts/fonts.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/image.c',

View File

@ -80,6 +80,7 @@ CPPPATH_MOD += [
SOURCE_MOD += [
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/colors.c',
'embed/lib/fonts/fonts.c',
'embed/lib/fonts/font_bitmap.c',

View File

@ -55,6 +55,7 @@ CPPPATH_MOD += [
]
SOURCE_MOD += [
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/colors.c',
'embed/lib/fonts/fonts.c',
'embed/lib/fonts/font_bitmap.c',

View File

@ -191,6 +191,7 @@ SOURCE_MOD += [
'embed/lib/buffers.c',
'embed/lib/colors.c',
'embed/lib/display.c',
'embed/lib/display_utils.c',
'embed/lib/fonts/fonts.c',
'embed/lib/fonts/font_bitmap.c',
'embed/lib/image.c',

View File

@ -23,6 +23,7 @@
#include "bootui.h"
#include "display.h"
#include "display_utils.h"
#ifdef TREZOR_EMULATOR
#include "emulator.h"
#else

View File

@ -21,6 +21,7 @@
#include "bootui.h"
#include "display.h"
#include "display_utils.h"
#include "icon_done.h"
#include "icon_fail.h"
#include "icon_install.h"

View File

@ -356,13 +356,3 @@ void display_offset(int set_xy[2], int *get_x, int *get_y) {
*get_x = DISPLAY_OFFSET.x;
*get_y = DISPLAY_OFFSET.y;
}
void display_fade(int start, int end, int delay) {
#ifdef USE_BACKLIGHT
for (int i = 0; i < 100; i++) {
display_backlight(start + i * (end - start) / 100);
hal_delay(delay / 100);
}
display_backlight(end);
#endif
}

View File

@ -48,6 +48,5 @@ void display_text_render_buffer(const char *text, int textlen, int font,
void display_qrcode(int x, int y, const char *data, uint8_t scale);
void display_offset(int set_xy[2], int *get_x, int *get_y);
void display_fade(int start, int end, int delay);
#endif

View File

@ -0,0 +1,31 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* 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/>.
*/
#include "common.h"
#include "display.h"
void display_fade(int start, int end, int delay) {
#ifdef USE_BACKLIGHT
for (int i = 0; i < 100; i++) {
display_backlight(start + i * (end - start) / 100);
hal_delay(delay / 100);
}
display_backlight(end);
#endif
}

View File

@ -0,0 +1,25 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* 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/>.
*/
#ifndef LIB_DISPLAY_UTILS_H
#define LIB_DISPLAY_UTILS_H
void display_fade(int start, int end, int delay);
#endif // LIB_DISPLAY_UTILS_H

View File

@ -26,6 +26,7 @@
#include "button.h"
#include "common.h"
#include "display.h"
#include "display_utils.h"
#include "flash.h"
#include "i2c.h"
#include "model.h"