mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-15 00:52:02 +00:00
refactor(core/embed): introduce display_utils.c
[no changelog]
This commit is contained in:
parent
cc6ed93b32
commit
3b9dd55788
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "bootui.h"
|
||||
#include "display.h"
|
||||
#include "display_utils.h"
|
||||
#ifdef TREZOR_EMULATOR
|
||||
#include "emulator.h"
|
||||
#else
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
31
core/embed/lib/display_utils.c
Normal file
31
core/embed/lib/display_utils.c
Normal 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
|
||||
}
|
25
core/embed/lib/display_utils.h
Normal file
25
core/embed/lib/display_utils.h
Normal 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
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user