feat(core/rust): expose touch processing functions to rust

grdddj/different_colors_for_old_display
tychovrahe 2 years ago committed by Martin Milata
parent cacae36c73
commit e75f112ec2

@ -337,7 +337,16 @@ fn generate_trezorhal_bindings() {
.allowlist_var("text_buffer_height")
.allowlist_var("buffer_width")
//usb
.allowlist_function("usb_configured");
.allowlist_function("usb_configured")
// touch
.allowlist_function("touch_read")
// button
.allowlist_function("button_read")
.allowlist_var("BTN_EVT_DOWN")
.allowlist_var("BTN_EVT_UP")
.allowlist_var("BTN_RIGHT")
.allowlist_var("BTN_LEFT");
// Write the bindings to a file in the OUR_DIR.
bindings
.generate()

@ -0,0 +1,14 @@
use super::ffi;
#[cfg(feature = "buttons")]
pub use super::ffi::{BTN_EVT_DOWN, BTN_EVT_UP, BTN_LEFT, BTN_RIGHT};
#[cfg(feature = "touch")]
pub fn io_touch_read() -> u32 {
unsafe { ffi::touch_read() }
}
#[cfg(feature = "buttons")]
pub fn io_button_read() -> u32 {
unsafe { ffi::button_read() }
}

@ -7,6 +7,7 @@ pub mod display;
#[cfg(feature = "dma2d")]
pub mod dma2d;
mod ffi;
pub mod io;
pub mod qr;
pub mod random;
#[cfg(feature = "model_tr")]

@ -1,5 +1,6 @@
#include TREZOR_BOARD
#include "buffers.h"
#include "button.h"
#include "common.h"
#include "display.h"
#include "display_interface.h"
@ -9,6 +10,7 @@
#include "rgb_led.h"
#include "secbool.h"
#include "storage.h"
#include "touch/touch.h"
#include "usb.h"
#include "bip39.h"

Loading…
Cancel
Save