Compare commits

...

9 commits

Author SHA1 Message Date
Jay Jackson
601a87d513 add use-vendored-config feature 2022-05-19 14:23:44 +02:00
Jay Jackson
faa3a19215 bump versions 2022-05-17 22:52:57 +02:00
Jay Jackson
029d230cab remove leftover files 2022-05-17 22:52:57 +02:00
Jay Jackson
ade4ae5a2d fix clippy warnings 2022-05-17 22:52:57 +02:00
Jay Jackson
37950d6e2e windows support 2022-05-17 22:52:57 +02:00
Sam Jones
763b78e45d Implement Clone for Style 2022-03-22 15:17:17 +01:00
0a5b5a0416
🇺🇦 This project supports Ukraine 2022-03-08 11:52:01 +00:00
a5c27b58ae
🇺🇦 This project supports Ukraine 2022-03-08 11:49:26 +00:00
Tim Newsome
cbbdc7e750 Add --features="alloc" to run demo
Without that, I got the following error from cargo:
```
error: target `demo` in package `lvgl` requires the features: `alloc`
Consider enabling them by passing, e.g., `--features="alloc"`
```
2022-01-10 14:35:54 +01:00
10 changed files with 301 additions and 266 deletions

View file

@ -1,3 +1,5 @@
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
<h1 align="center"> LVGL - Open-source Embedded GUI Library in Rust</h1>
![Original LVGL demo image](lv_demo.png)
@ -86,7 +88,7 @@ $ git submodule update
Then run the `demo` example:
```shell
$ DEP_LV_CONFIG_PATH=`pwd`/examples/include cargo run --example demo
$ DEP_LV_CONFIG_PATH=`pwd`/examples/include cargo run --example demo --features="alloc"
```
## Feature Support

View file

@ -303,21 +303,21 @@ impl Rusty for LvArg {
#[derive(Clone)]
pub struct LvType {
literal_name: String,
r_type: Option<Box<syn::Type>>,
_r_type: Option<Box<syn::Type>>,
}
impl LvType {
pub fn new(literal_name: String) -> Self {
Self {
literal_name,
r_type: None,
_r_type: None,
}
}
pub fn from(r_type: Box<syn::Type>) -> Self {
Self {
literal_name: r_type.to_token_stream().to_string(),
r_type: Some(r_type),
_r_type: Some(r_type),
}
}

View file

@ -21,4 +21,7 @@ cty = "0.2.1"
[build-dependencies]
cc = "1.0.68"
bindgen = "0.58.1"
bindgen = "0.59.2"
[features]
use-vendored-config = []

View file

@ -4,16 +4,14 @@ use std::{env, path::Path, path::PathBuf};
static CONFIG_NAME: &str = "DEP_LV_CONFIG_PATH";
fn main() {
let project_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.canonicalize()
.unwrap();
let project_dir = canonicalize(PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()));
let shims_dir = project_dir.join("shims");
let vendor = project_dir.join("vendor");
let vendor_src = vendor.join("lvgl").join("src");
let lv_config_dir = {
let conf_path = env::var(CONFIG_NAME)
.map(|raw_path| PathBuf::from(raw_path))
.map(PathBuf::from)
.unwrap_or_else(|_| {
match std::env::var("DOCS_RS") {
Ok(_) => {
@ -21,10 +19,16 @@ fn main() {
// so let's use the vendored `lv_conf.h` file.
vendor.join("include")
}
Err(_) => panic!(
Err(_) => {
#[cfg(not(feature = "use-vendored-config"))]
panic!(
"The environment variable {} is required to be defined",
CONFIG_NAME
),
);
#[cfg(feature = "use-vendored-config")]
vendor.join("include")
}
}
});
@ -139,3 +143,10 @@ fn add_c_files(build: &mut cc::Build, path: impl AsRef<Path>) {
}
}
}
fn canonicalize(path: impl AsRef<Path>) -> PathBuf {
let canonicalized = path.as_ref().canonicalize().unwrap();
let canonicalized = &*canonicalized.to_string_lossy();
PathBuf::from(canonicalized.strip_prefix(r"\\?\").unwrap_or(canonicalized))
}

View file

@ -14,13 +14,14 @@ build = "build.rs"
[dependencies]
lvgl-sys = { version = "0.5.2", path = "../lvgl-sys" }
cty = "0.2.1"
embedded-graphics = "0.6.2"
embedded-graphics = "0.7.1"
cstr_core = "0.2.3"
bitflags = "1.2.1"
[features]
alloc = ["cstr_core/alloc"]
lvgl_alloc = ["alloc"]
use-vendored-config = ["lvgl-sys/use-vendored-config"]
[build-dependencies]
quote = "1.0.9"
@ -29,8 +30,8 @@ lvgl-codegen = { version = "0.5.2", path = "../lvgl-codegen" }
lvgl-sys = { version = "0.5.2", path = "../lvgl-sys" }
[dev-dependencies]
embedded-graphics-simulator = "0.2.1"
heapless = "0.5.5"
embedded-graphics-simulator = "0.3.0"
heapless = "0.7.13"
[[example]]
name = "demo"

View file

@ -179,19 +179,19 @@ macro_rules! define_object {
bitflags! {
pub struct State: u32 {
/// Normal, released
const DEFAULT = lvgl_sys::LV_STATE_DEFAULT;
const DEFAULT = lvgl_sys::LV_STATE_DEFAULT as u32;
/// Toggled or checked
const CHECKED = lvgl_sys::LV_STATE_CHECKED;
const CHECKED = lvgl_sys::LV_STATE_CHECKED as u32;
/// Focused via keypad or encoder or clicked via touchpad/mouse
const FOCUSED = lvgl_sys::LV_STATE_FOCUSED;
const FOCUSED = lvgl_sys::LV_STATE_FOCUSED as u32;
/// Edit by an encoder
const EDITED = lvgl_sys::LV_STATE_EDITED;
const EDITED = lvgl_sys::LV_STATE_EDITED as u32;
/// Hovered by mouse (not supported now)
const HOVERED = lvgl_sys::LV_STATE_HOVERED;
const HOVERED = lvgl_sys::LV_STATE_HOVERED as u32;
/// Pressed
const PRESSED = lvgl_sys::LV_STATE_PRESSED;
const PRESSED = lvgl_sys::LV_STATE_PRESSED as u32;
/// Disabled or inactive
const DISABLED = lvgl_sys::LV_STATE_DISABLED;
const DISABLED = lvgl_sys::LV_STATE_DISABLED as u32;
}
}
@ -206,9 +206,9 @@ pub enum Part {
All,
}
impl Into<u8> for Part {
fn into(self) -> u8 {
match self {
impl From<Part> for u8 {
fn from(self_: Part) -> u8 {
match self_ {
Part::Main => lvgl_sys::LV_OBJ_PART_MAIN as u8,
Part::All => lvgl_sys::LV_OBJ_PART_ALL as u8,
}

View file

@ -7,6 +7,7 @@ pub enum Themes {
Pretty,
}
#[derive(Clone)]
pub struct Style {
pub(crate) raw: Box<lvgl_sys::lv_style_t>,
}
@ -17,7 +18,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_ptr(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_STR
(lvgl_sys::LV_STYLE_VALUE_STR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.as_ptr() as *mut cty::c_void,
);
@ -39,122 +40,122 @@ impl Default for Style {
bitflags! {
pub struct Opacity: u32 {
const OPA_TRANSP = lvgl_sys::LV_OPA_TRANSP;
const OPA_0 = lvgl_sys::LV_OPA_0;
const OPA_10 = lvgl_sys::LV_OPA_10;
const OPA_20 = lvgl_sys::LV_OPA_20;
const OPA_30 = lvgl_sys::LV_OPA_30;
const OPA_40 = lvgl_sys::LV_OPA_40;
const OPA_50 = lvgl_sys::LV_OPA_50;
const OPA_60 = lvgl_sys::LV_OPA_60;
const OPA_70 = lvgl_sys::LV_OPA_70;
const OPA_80 = lvgl_sys::LV_OPA_80;
const OPA_90 = lvgl_sys::LV_OPA_90;
const OPA_100 = lvgl_sys::LV_OPA_100;
const OPA_COVER = lvgl_sys::LV_OPA_COVER;
const OPA_TRANSP = lvgl_sys::LV_OPA_TRANSP as u32;
const OPA_0 = lvgl_sys::LV_OPA_0 as u32;
const OPA_10 = lvgl_sys::LV_OPA_10 as u32;
const OPA_20 = lvgl_sys::LV_OPA_20 as u32;
const OPA_30 = lvgl_sys::LV_OPA_30 as u32;
const OPA_40 = lvgl_sys::LV_OPA_40 as u32;
const OPA_50 = lvgl_sys::LV_OPA_50 as u32;
const OPA_60 = lvgl_sys::LV_OPA_60 as u32;
const OPA_70 = lvgl_sys::LV_OPA_70 as u32;
const OPA_80 = lvgl_sys::LV_OPA_80 as u32;
const OPA_90 = lvgl_sys::LV_OPA_90 as u32;
const OPA_100 = lvgl_sys::LV_OPA_100 as u32;
const OPA_COVER = lvgl_sys::LV_OPA_COVER as u32;
}
}
impl Into<u8> for Opacity {
fn into(self) -> u8 {
self.bits as u8
impl From<Opacity> for u8 {
fn from(self_: Opacity) -> u8 {
self_.bits as u8
}
}
bitflags! {
pub struct StyleProp: u32 {
const RADIUS = lvgl_sys::LV_STYLE_RADIUS;
const CLIP_CORNER = lvgl_sys::LV_STYLE_CLIP_CORNER;
const SIZE = lvgl_sys::LV_STYLE_SIZE;
const TRANSFORM_WIDTH = lvgl_sys::LV_STYLE_TRANSFORM_WIDTH;
const TRANSFORM_HEIGHT = lvgl_sys::LV_STYLE_TRANSFORM_HEIGHT;
const TRANSFORM_ANGLE = lvgl_sys::LV_STYLE_TRANSFORM_ANGLE;
const TRANSFORM_ZOOM = lvgl_sys::LV_STYLE_TRANSFORM_ZOOM;
const OPA_SCALE = lvgl_sys::LV_STYLE_OPA_SCALE;
const PAD_TOP = lvgl_sys::LV_STYLE_PAD_TOP;
const PAD_BOTTOM = lvgl_sys::LV_STYLE_PAD_BOTTOM;
const PAD_LEFT = lvgl_sys::LV_STYLE_PAD_LEFT;
const PAD_RIGHT = lvgl_sys::LV_STYLE_PAD_RIGHT;
const PAD_INNER = lvgl_sys::LV_STYLE_PAD_INNER;
const MARGIN_TOP = lvgl_sys::LV_STYLE_MARGIN_TOP;
const MARGIN_BOTTOM = lvgl_sys::LV_STYLE_MARGIN_BOTTOM;
const MARGIN_LEFT = lvgl_sys::LV_STYLE_MARGIN_LEFT;
const MARGIN_RIGHT = lvgl_sys::LV_STYLE_MARGIN_RIGHT;
const BG_BLEND_MODE = lvgl_sys::LV_STYLE_BG_BLEND_MODE;
const BG_MAIN_STOP = lvgl_sys::LV_STYLE_BG_MAIN_STOP;
const BG_GRAD_STOP = lvgl_sys::LV_STYLE_BG_GRAD_STOP;
const BG_GRAD_DIR = lvgl_sys::LV_STYLE_BG_GRAD_DIR;
const BG_COLOR = lvgl_sys::LV_STYLE_BG_COLOR;
const BG_GRAD_COLOR = lvgl_sys::LV_STYLE_BG_GRAD_COLOR;
const BG_OPA = lvgl_sys::LV_STYLE_BG_OPA;
const BORDER_WIDTH = lvgl_sys::LV_STYLE_BORDER_WIDTH;
const BORDER_SIDE = lvgl_sys::LV_STYLE_BORDER_SIDE;
const BORDER_BLEND_MODE = lvgl_sys::LV_STYLE_BORDER_BLEND_MODE;
const BORDER_POST = lvgl_sys::LV_STYLE_BORDER_POST;
const BORDER_COLOR = lvgl_sys::LV_STYLE_BORDER_COLOR;
const BORDER_OPA = lvgl_sys::LV_STYLE_BORDER_OPA;
const OUTLINE_WIDTH = lvgl_sys::LV_STYLE_OUTLINE_WIDTH;
const OUTLINE_PAD = lvgl_sys::LV_STYLE_OUTLINE_PAD;
const OUTLINE_BLEND_MODE = lvgl_sys::LV_STYLE_OUTLINE_BLEND_MODE;
const OUTLINE_COLOR = lvgl_sys::LV_STYLE_OUTLINE_COLOR;
const OUTLINE_OPA = lvgl_sys::LV_STYLE_OUTLINE_OPA;
const SHADOW_WIDTH = lvgl_sys::LV_STYLE_SHADOW_WIDTH;
const SHADOW_OFS_X = lvgl_sys::LV_STYLE_SHADOW_OFS_X;
const SHADOW_OFS_Y = lvgl_sys::LV_STYLE_SHADOW_OFS_Y;
const SHADOW_SPREAD = lvgl_sys::LV_STYLE_SHADOW_SPREAD;
const SHADOW_BLEND_MODE = lvgl_sys::LV_STYLE_SHADOW_BLEND_MODE;
const SHADOW_COLOR = lvgl_sys::LV_STYLE_SHADOW_COLOR;
const SHADOW_OPA = lvgl_sys::LV_STYLE_SHADOW_OPA;
const PATTERN_BLEND_MODE = lvgl_sys::LV_STYLE_PATTERN_BLEND_MODE;
const PATTERN_REPEAT = lvgl_sys::LV_STYLE_PATTERN_REPEAT;
const PATTERN_RECOLOR = lvgl_sys::LV_STYLE_PATTERN_RECOLOR;
const PATTERN_OPA = lvgl_sys::LV_STYLE_PATTERN_OPA;
const PATTERN_RECOLOR_OPA = lvgl_sys::LV_STYLE_PATTERN_RECOLOR_OPA;
const PATTERN_IMAGE = lvgl_sys::LV_STYLE_PATTERN_IMAGE;
const VALUE_LETTER_SPACE = lvgl_sys::LV_STYLE_VALUE_LETTER_SPACE;
const VALUE_LINE_SPACE = lvgl_sys::LV_STYLE_VALUE_LINE_SPACE;
const VALUE_BLEND_MODE = lvgl_sys::LV_STYLE_VALUE_BLEND_MODE;
const VALUE_OFS_X = lvgl_sys::LV_STYLE_VALUE_OFS_X;
const VALUE_OFS_Y = lvgl_sys::LV_STYLE_VALUE_OFS_Y;
const VALUE_ALIGN = lvgl_sys::LV_STYLE_VALUE_ALIGN;
const VALUE_COLOR = lvgl_sys::LV_STYLE_VALUE_COLOR;
const VALUE_OPA = lvgl_sys::LV_STYLE_VALUE_OPA;
const VALUE_FONT = lvgl_sys::LV_STYLE_VALUE_FONT;
const VALUE_STR = lvgl_sys::LV_STYLE_VALUE_STR;
const TEXT_LETTER_SPACE = lvgl_sys::LV_STYLE_TEXT_LETTER_SPACE;
const TEXT_LINE_SPACE = lvgl_sys::LV_STYLE_TEXT_LINE_SPACE;
const TEXT_DECOR = lvgl_sys::LV_STYLE_TEXT_DECOR;
const TEXT_BLEND_MODE = lvgl_sys::LV_STYLE_TEXT_BLEND_MODE;
const TEXT_COLOR = lvgl_sys::LV_STYLE_TEXT_COLOR;
const TEXT_SEL_COLOR = lvgl_sys::LV_STYLE_TEXT_SEL_COLOR;
const TEXT_OPA = lvgl_sys::LV_STYLE_TEXT_OPA;
const TEXT_FONT = lvgl_sys::LV_STYLE_TEXT_FONT;
const LINE_WIDTH = lvgl_sys::LV_STYLE_LINE_WIDTH;
const LINE_BLEND_MODE = lvgl_sys::LV_STYLE_LINE_BLEND_MODE;
const LINE_DASH_WIDTH = lvgl_sys::LV_STYLE_LINE_DASH_WIDTH;
const LINE_DASH_GAP = lvgl_sys::LV_STYLE_LINE_DASH_GAP;
const LINE_ROUNDED = lvgl_sys::LV_STYLE_LINE_ROUNDED;
const LINE_COLOR = lvgl_sys::LV_STYLE_LINE_COLOR;
const LINE_OPA = lvgl_sys::LV_STYLE_LINE_OPA;
const IMAGE_BLEND_MODE = lvgl_sys::LV_STYLE_IMAGE_BLEND_MODE;
const IMAGE_RECOLOR = lvgl_sys::LV_STYLE_IMAGE_RECOLOR;
const IMAGE_OPA = lvgl_sys::LV_STYLE_IMAGE_OPA;
const IMAGE_RECOLOR_OPA = lvgl_sys::LV_STYLE_IMAGE_RECOLOR_OPA;
const TRANSITION_TIME = lvgl_sys::LV_STYLE_TRANSITION_TIME;
const TRANSITION_DELAY = lvgl_sys::LV_STYLE_TRANSITION_DELAY;
const TRANSITION_PROP_1 = lvgl_sys::LV_STYLE_TRANSITION_PROP_1;
const TRANSITION_PROP_2 = lvgl_sys::LV_STYLE_TRANSITION_PROP_2;
const TRANSITION_PROP_3 = lvgl_sys::LV_STYLE_TRANSITION_PROP_3;
const TRANSITION_PROP_4 = lvgl_sys::LV_STYLE_TRANSITION_PROP_4;
const TRANSITION_PROP_5 = lvgl_sys::LV_STYLE_TRANSITION_PROP_5;
const TRANSITION_PROP_6 = lvgl_sys::LV_STYLE_TRANSITION_PROP_6;
const TRANSITION_PATH = lvgl_sys::LV_STYLE_TRANSITION_PATH;
const SCALE_WIDTH = lvgl_sys::LV_STYLE_SCALE_WIDTH;
const SCALE_BORDER_WIDTH = lvgl_sys::LV_STYLE_SCALE_BORDER_WIDTH;
const SCALE_END_BORDER_WIDTH = lvgl_sys::LV_STYLE_SCALE_END_BORDER_WIDTH;
const SCALE_END_LINE_WIDTH = lvgl_sys::LV_STYLE_SCALE_END_LINE_WIDTH;
const SCALE_GRAD_COLOR = lvgl_sys::LV_STYLE_SCALE_GRAD_COLOR;
const SCALE_END_COLOR = lvgl_sys::LV_STYLE_SCALE_END_COLOR;
const RADIUS = lvgl_sys::LV_STYLE_RADIUS as u32;
const CLIP_CORNER = lvgl_sys::LV_STYLE_CLIP_CORNER as u32;
const SIZE = lvgl_sys::LV_STYLE_SIZE as u32;
const TRANSFORM_WIDTH = lvgl_sys::LV_STYLE_TRANSFORM_WIDTH as u32;
const TRANSFORM_HEIGHT = lvgl_sys::LV_STYLE_TRANSFORM_HEIGHT as u32;
const TRANSFORM_ANGLE = lvgl_sys::LV_STYLE_TRANSFORM_ANGLE as u32;
const TRANSFORM_ZOOM = lvgl_sys::LV_STYLE_TRANSFORM_ZOOM as u32;
const OPA_SCALE = lvgl_sys::LV_STYLE_OPA_SCALE as u32;
const PAD_TOP = lvgl_sys::LV_STYLE_PAD_TOP as u32;
const PAD_BOTTOM = lvgl_sys::LV_STYLE_PAD_BOTTOM as u32;
const PAD_LEFT = lvgl_sys::LV_STYLE_PAD_LEFT as u32;
const PAD_RIGHT = lvgl_sys::LV_STYLE_PAD_RIGHT as u32;
const PAD_INNER = lvgl_sys::LV_STYLE_PAD_INNER as u32;
const MARGIN_TOP = lvgl_sys::LV_STYLE_MARGIN_TOP as u32;
const MARGIN_BOTTOM = lvgl_sys::LV_STYLE_MARGIN_BOTTOM as u32;
const MARGIN_LEFT = lvgl_sys::LV_STYLE_MARGIN_LEFT as u32;
const MARGIN_RIGHT = lvgl_sys::LV_STYLE_MARGIN_RIGHT as u32;
const BG_BLEND_MODE = lvgl_sys::LV_STYLE_BG_BLEND_MODE as u32;
const BG_MAIN_STOP = lvgl_sys::LV_STYLE_BG_MAIN_STOP as u32;
const BG_GRAD_STOP = lvgl_sys::LV_STYLE_BG_GRAD_STOP as u32;
const BG_GRAD_DIR = lvgl_sys::LV_STYLE_BG_GRAD_DIR as u32;
const BG_COLOR = lvgl_sys::LV_STYLE_BG_COLOR as u32;
const BG_GRAD_COLOR = lvgl_sys::LV_STYLE_BG_GRAD_COLOR as u32;
const BG_OPA = lvgl_sys::LV_STYLE_BG_OPA as u32;
const BORDER_WIDTH = lvgl_sys::LV_STYLE_BORDER_WIDTH as u32;
const BORDER_SIDE = lvgl_sys::LV_STYLE_BORDER_SIDE as u32;
const BORDER_BLEND_MODE = lvgl_sys::LV_STYLE_BORDER_BLEND_MODE as u32;
const BORDER_POST = lvgl_sys::LV_STYLE_BORDER_POST as u32;
const BORDER_COLOR = lvgl_sys::LV_STYLE_BORDER_COLOR as u32;
const BORDER_OPA = lvgl_sys::LV_STYLE_BORDER_OPA as u32;
const OUTLINE_WIDTH = lvgl_sys::LV_STYLE_OUTLINE_WIDTH as u32;
const OUTLINE_PAD = lvgl_sys::LV_STYLE_OUTLINE_PAD as u32;
const OUTLINE_BLEND_MODE = lvgl_sys::LV_STYLE_OUTLINE_BLEND_MODE as u32;
const OUTLINE_COLOR = lvgl_sys::LV_STYLE_OUTLINE_COLOR as u32;
const OUTLINE_OPA = lvgl_sys::LV_STYLE_OUTLINE_OPA as u32;
const SHADOW_WIDTH = lvgl_sys::LV_STYLE_SHADOW_WIDTH as u32;
const SHADOW_OFS_X = lvgl_sys::LV_STYLE_SHADOW_OFS_X as u32;
const SHADOW_OFS_Y = lvgl_sys::LV_STYLE_SHADOW_OFS_Y as u32;
const SHADOW_SPREAD = lvgl_sys::LV_STYLE_SHADOW_SPREAD as u32;
const SHADOW_BLEND_MODE = lvgl_sys::LV_STYLE_SHADOW_BLEND_MODE as u32;
const SHADOW_COLOR = lvgl_sys::LV_STYLE_SHADOW_COLOR as u32;
const SHADOW_OPA = lvgl_sys::LV_STYLE_SHADOW_OPA as u32;
const PATTERN_BLEND_MODE = lvgl_sys::LV_STYLE_PATTERN_BLEND_MODE as u32;
const PATTERN_REPEAT = lvgl_sys::LV_STYLE_PATTERN_REPEAT as u32;
const PATTERN_RECOLOR = lvgl_sys::LV_STYLE_PATTERN_RECOLOR as u32;
const PATTERN_OPA = lvgl_sys::LV_STYLE_PATTERN_OPA as u32;
const PATTERN_RECOLOR_OPA = lvgl_sys::LV_STYLE_PATTERN_RECOLOR_OPA as u32;
const PATTERN_IMAGE = lvgl_sys::LV_STYLE_PATTERN_IMAGE as u32;
const VALUE_LETTER_SPACE = lvgl_sys::LV_STYLE_VALUE_LETTER_SPACE as u32;
const VALUE_LINE_SPACE = lvgl_sys::LV_STYLE_VALUE_LINE_SPACE as u32;
const VALUE_BLEND_MODE = lvgl_sys::LV_STYLE_VALUE_BLEND_MODE as u32;
const VALUE_OFS_X = lvgl_sys::LV_STYLE_VALUE_OFS_X as u32;
const VALUE_OFS_Y = lvgl_sys::LV_STYLE_VALUE_OFS_Y as u32;
const VALUE_ALIGN = lvgl_sys::LV_STYLE_VALUE_ALIGN as u32;
const VALUE_COLOR = lvgl_sys::LV_STYLE_VALUE_COLOR as u32;
const VALUE_OPA = lvgl_sys::LV_STYLE_VALUE_OPA as u32;
const VALUE_FONT = lvgl_sys::LV_STYLE_VALUE_FONT as u32;
const VALUE_STR = lvgl_sys::LV_STYLE_VALUE_STR as u32;
const TEXT_LETTER_SPACE = lvgl_sys::LV_STYLE_TEXT_LETTER_SPACE as u32;
const TEXT_LINE_SPACE = lvgl_sys::LV_STYLE_TEXT_LINE_SPACE as u32;
const TEXT_DECOR = lvgl_sys::LV_STYLE_TEXT_DECOR as u32;
const TEXT_BLEND_MODE = lvgl_sys::LV_STYLE_TEXT_BLEND_MODE as u32;
const TEXT_COLOR = lvgl_sys::LV_STYLE_TEXT_COLOR as u32;
const TEXT_SEL_COLOR = lvgl_sys::LV_STYLE_TEXT_SEL_COLOR as u32;
const TEXT_OPA = lvgl_sys::LV_STYLE_TEXT_OPA as u32;
const TEXT_FONT = lvgl_sys::LV_STYLE_TEXT_FONT as u32;
const LINE_WIDTH = lvgl_sys::LV_STYLE_LINE_WIDTH as u32;
const LINE_BLEND_MODE = lvgl_sys::LV_STYLE_LINE_BLEND_MODE as u32;
const LINE_DASH_WIDTH = lvgl_sys::LV_STYLE_LINE_DASH_WIDTH as u32;
const LINE_DASH_GAP = lvgl_sys::LV_STYLE_LINE_DASH_GAP as u32;
const LINE_ROUNDED = lvgl_sys::LV_STYLE_LINE_ROUNDED as u32;
const LINE_COLOR = lvgl_sys::LV_STYLE_LINE_COLOR as u32;
const LINE_OPA = lvgl_sys::LV_STYLE_LINE_OPA as u32;
const IMAGE_BLEND_MODE = lvgl_sys::LV_STYLE_IMAGE_BLEND_MODE as u32;
const IMAGE_RECOLOR = lvgl_sys::LV_STYLE_IMAGE_RECOLOR as u32;
const IMAGE_OPA = lvgl_sys::LV_STYLE_IMAGE_OPA as u32;
const IMAGE_RECOLOR_OPA = lvgl_sys::LV_STYLE_IMAGE_RECOLOR_OPA as u32;
const TRANSITION_TIME = lvgl_sys::LV_STYLE_TRANSITION_TIME as u32;
const TRANSITION_DELAY = lvgl_sys::LV_STYLE_TRANSITION_DELAY as u32;
const TRANSITION_PROP_1 = lvgl_sys::LV_STYLE_TRANSITION_PROP_1 as u32;
const TRANSITION_PROP_2 = lvgl_sys::LV_STYLE_TRANSITION_PROP_2 as u32;
const TRANSITION_PROP_3 = lvgl_sys::LV_STYLE_TRANSITION_PROP_3 as u32;
const TRANSITION_PROP_4 = lvgl_sys::LV_STYLE_TRANSITION_PROP_4 as u32;
const TRANSITION_PROP_5 = lvgl_sys::LV_STYLE_TRANSITION_PROP_5 as u32;
const TRANSITION_PROP_6 = lvgl_sys::LV_STYLE_TRANSITION_PROP_6 as u32;
const TRANSITION_PATH = lvgl_sys::LV_STYLE_TRANSITION_PATH as u32;
const SCALE_WIDTH = lvgl_sys::LV_STYLE_SCALE_WIDTH as u32;
const SCALE_BORDER_WIDTH = lvgl_sys::LV_STYLE_SCALE_BORDER_WIDTH as u32;
const SCALE_END_BORDER_WIDTH = lvgl_sys::LV_STYLE_SCALE_END_BORDER_WIDTH as u32;
const SCALE_END_LINE_WIDTH = lvgl_sys::LV_STYLE_SCALE_END_LINE_WIDTH as u32;
const SCALE_GRAD_COLOR = lvgl_sys::LV_STYLE_SCALE_GRAD_COLOR as u32;
const SCALE_END_COLOR = lvgl_sys::LV_STYLE_SCALE_END_COLOR as u32;
}
}
@ -165,8 +166,8 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_RADIUS | (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32))
as u16,
(lvgl_sys::LV_STYLE_RADIUS as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
}
@ -177,7 +178,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_CLIP_CORNER
(lvgl_sys::LV_STYLE_CLIP_CORNER as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -189,8 +190,8 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SIZE | (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32))
as u16,
(lvgl_sys::LV_STYLE_SIZE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
}
@ -201,7 +202,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSFORM_WIDTH
(lvgl_sys::LV_STYLE_TRANSFORM_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -213,7 +214,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSFORM_HEIGHT
(lvgl_sys::LV_STYLE_TRANSFORM_HEIGHT as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -225,7 +226,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSFORM_ANGLE
(lvgl_sys::LV_STYLE_TRANSFORM_ANGLE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -237,7 +238,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSFORM_ZOOM
(lvgl_sys::LV_STYLE_TRANSFORM_ZOOM as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -249,7 +250,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_OPA_SCALE
(lvgl_sys::LV_STYLE_OPA_SCALE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -261,8 +262,8 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PAD_TOP | (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32))
as u16,
(lvgl_sys::LV_STYLE_PAD_TOP as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
}
@ -273,7 +274,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PAD_BOTTOM
(lvgl_sys::LV_STYLE_PAD_BOTTOM as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -285,7 +286,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PAD_LEFT
(lvgl_sys::LV_STYLE_PAD_LEFT as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -297,7 +298,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PAD_RIGHT
(lvgl_sys::LV_STYLE_PAD_RIGHT as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -309,7 +310,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PAD_INNER
(lvgl_sys::LV_STYLE_PAD_INNER as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -321,7 +322,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_MARGIN_TOP
(lvgl_sys::LV_STYLE_MARGIN_TOP as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -333,7 +334,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_MARGIN_BOTTOM
(lvgl_sys::LV_STYLE_MARGIN_BOTTOM as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -345,7 +346,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_MARGIN_LEFT
(lvgl_sys::LV_STYLE_MARGIN_LEFT as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -357,7 +358,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_MARGIN_RIGHT
(lvgl_sys::LV_STYLE_MARGIN_RIGHT as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -369,7 +370,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BG_BLEND_MODE
(lvgl_sys::LV_STYLE_BG_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -381,7 +382,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BG_MAIN_STOP
(lvgl_sys::LV_STYLE_BG_MAIN_STOP as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -393,7 +394,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BG_GRAD_STOP
(lvgl_sys::LV_STYLE_BG_GRAD_STOP as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -405,7 +406,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BG_GRAD_DIR
(lvgl_sys::LV_STYLE_BG_GRAD_DIR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -417,7 +418,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BG_COLOR
(lvgl_sys::LV_STYLE_BG_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -429,7 +430,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BG_GRAD_COLOR
(lvgl_sys::LV_STYLE_BG_GRAD_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -441,8 +442,8 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BG_OPA | (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32))
as u16,
(lvgl_sys::LV_STYLE_BG_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
}
@ -453,7 +454,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BORDER_WIDTH
(lvgl_sys::LV_STYLE_BORDER_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -465,7 +466,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BORDER_SIDE
(lvgl_sys::LV_STYLE_BORDER_SIDE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -477,7 +478,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BORDER_BLEND_MODE
(lvgl_sys::LV_STYLE_BORDER_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -489,7 +490,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BORDER_POST
(lvgl_sys::LV_STYLE_BORDER_POST as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -501,7 +502,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BORDER_COLOR
(lvgl_sys::LV_STYLE_BORDER_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -513,7 +514,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_BORDER_OPA
(lvgl_sys::LV_STYLE_BORDER_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -525,7 +526,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_OUTLINE_WIDTH
(lvgl_sys::LV_STYLE_OUTLINE_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -537,7 +538,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_OUTLINE_PAD
(lvgl_sys::LV_STYLE_OUTLINE_PAD as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -549,7 +550,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_OUTLINE_BLEND_MODE
(lvgl_sys::LV_STYLE_OUTLINE_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -561,7 +562,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_OUTLINE_COLOR
(lvgl_sys::LV_STYLE_OUTLINE_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -573,7 +574,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_OUTLINE_OPA
(lvgl_sys::LV_STYLE_OUTLINE_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -585,7 +586,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SHADOW_WIDTH
(lvgl_sys::LV_STYLE_SHADOW_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -597,7 +598,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SHADOW_OFS_X
(lvgl_sys::LV_STYLE_SHADOW_OFS_X as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -609,7 +610,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SHADOW_OFS_Y
(lvgl_sys::LV_STYLE_SHADOW_OFS_Y as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -621,7 +622,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SHADOW_SPREAD
(lvgl_sys::LV_STYLE_SHADOW_SPREAD as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -633,7 +634,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SHADOW_BLEND_MODE
(lvgl_sys::LV_STYLE_SHADOW_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -645,7 +646,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SHADOW_COLOR
(lvgl_sys::LV_STYLE_SHADOW_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -657,7 +658,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SHADOW_OPA
(lvgl_sys::LV_STYLE_SHADOW_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -669,7 +670,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PATTERN_REPEAT
(lvgl_sys::LV_STYLE_PATTERN_REPEAT as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -681,7 +682,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PATTERN_BLEND_MODE
(lvgl_sys::LV_STYLE_PATTERN_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -693,7 +694,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PATTERN_RECOLOR
(lvgl_sys::LV_STYLE_PATTERN_RECOLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -705,7 +706,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PATTERN_OPA
(lvgl_sys::LV_STYLE_PATTERN_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -717,7 +718,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_PATTERN_RECOLOR_OPA
(lvgl_sys::LV_STYLE_PATTERN_RECOLOR_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -729,7 +730,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_LETTER_SPACE
(lvgl_sys::LV_STYLE_VALUE_LETTER_SPACE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -741,7 +742,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_LINE_SPACE
(lvgl_sys::LV_STYLE_VALUE_LINE_SPACE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -753,7 +754,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_BLEND_MODE
(lvgl_sys::LV_STYLE_VALUE_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -765,7 +766,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_OFS_X
(lvgl_sys::LV_STYLE_VALUE_OFS_X as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -777,7 +778,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_OFS_Y
(lvgl_sys::LV_STYLE_VALUE_OFS_Y as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -789,7 +790,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_ALIGN
(lvgl_sys::LV_STYLE_VALUE_ALIGN as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -801,7 +802,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_COLOR
(lvgl_sys::LV_STYLE_VALUE_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -813,7 +814,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_VALUE_OPA
(lvgl_sys::LV_STYLE_VALUE_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -825,7 +826,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TEXT_LETTER_SPACE
(lvgl_sys::LV_STYLE_TEXT_LETTER_SPACE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -837,7 +838,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TEXT_LINE_SPACE
(lvgl_sys::LV_STYLE_TEXT_LINE_SPACE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -849,7 +850,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TEXT_DECOR
(lvgl_sys::LV_STYLE_TEXT_DECOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -861,7 +862,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TEXT_BLEND_MODE
(lvgl_sys::LV_STYLE_TEXT_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -873,7 +874,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TEXT_COLOR
(lvgl_sys::LV_STYLE_TEXT_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -885,7 +886,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TEXT_SEL_COLOR
(lvgl_sys::LV_STYLE_TEXT_SEL_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -897,7 +898,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TEXT_OPA
(lvgl_sys::LV_STYLE_TEXT_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -909,7 +910,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_LINE_WIDTH
(lvgl_sys::LV_STYLE_LINE_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -921,7 +922,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_LINE_BLEND_MODE
(lvgl_sys::LV_STYLE_LINE_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -933,7 +934,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_LINE_DASH_WIDTH
(lvgl_sys::LV_STYLE_LINE_DASH_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -945,7 +946,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_LINE_DASH_GAP
(lvgl_sys::LV_STYLE_LINE_DASH_GAP as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -957,7 +958,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_LINE_ROUNDED
(lvgl_sys::LV_STYLE_LINE_ROUNDED as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -969,7 +970,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_LINE_COLOR
(lvgl_sys::LV_STYLE_LINE_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -981,7 +982,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_LINE_OPA
(lvgl_sys::LV_STYLE_LINE_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -993,7 +994,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_IMAGE_BLEND_MODE
(lvgl_sys::LV_STYLE_IMAGE_BLEND_MODE as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1005,7 +1006,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_IMAGE_RECOLOR
(lvgl_sys::LV_STYLE_IMAGE_RECOLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.raw,
);
@ -1017,7 +1018,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_IMAGE_OPA
(lvgl_sys::LV_STYLE_IMAGE_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -1029,7 +1030,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_opa(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_IMAGE_RECOLOR_OPA
(lvgl_sys::LV_STYLE_IMAGE_RECOLOR_OPA as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value.into(),
);
@ -1041,7 +1042,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_TIME
(lvgl_sys::LV_STYLE_TRANSITION_TIME as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1053,7 +1054,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_DELAY
(lvgl_sys::LV_STYLE_TRANSITION_DELAY as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1065,7 +1066,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_PROP_1
(lvgl_sys::LV_STYLE_TRANSITION_PROP_1 as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1077,7 +1078,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_PROP_2
(lvgl_sys::LV_STYLE_TRANSITION_PROP_2 as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1089,7 +1090,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_PROP_3
(lvgl_sys::LV_STYLE_TRANSITION_PROP_3 as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1101,7 +1102,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_PROP_4
(lvgl_sys::LV_STYLE_TRANSITION_PROP_4 as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1113,7 +1114,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_PROP_5
(lvgl_sys::LV_STYLE_TRANSITION_PROP_5 as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1125,7 +1126,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_TRANSITION_PROP_6
(lvgl_sys::LV_STYLE_TRANSITION_PROP_6 as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1137,7 +1138,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SCALE_WIDTH
(lvgl_sys::LV_STYLE_SCALE_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1149,7 +1150,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SCALE_BORDER_WIDTH
(lvgl_sys::LV_STYLE_SCALE_BORDER_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1161,7 +1162,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SCALE_END_BORDER_WIDTH
(lvgl_sys::LV_STYLE_SCALE_END_BORDER_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1173,7 +1174,7 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_int(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SCALE_END_LINE_WIDTH
(lvgl_sys::LV_STYLE_SCALE_END_LINE_WIDTH as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
value,
);
@ -1185,8 +1186,8 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SCALE_GRAD_COLOR
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
(lvgl_sys::LV_STYLE_SCALE_GRAD_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS)) as u16,
value.raw,
);
}
@ -1197,8 +1198,8 @@ impl Style {
unsafe {
lvgl_sys::_lv_style_set_color(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_SCALE_END_COLOR
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
(lvgl_sys::LV_STYLE_SCALE_END_COLOR as u32
| (native_state << lvgl_sys::LV_STYLE_STATE_POS)) as u16,
value.raw,
);
}

View file

@ -69,6 +69,12 @@ impl<T> AsMut<T> for Box<T> {
}
}
impl<T: Clone> Clone for Box<T> {
fn clone(&self) -> Self {
unsafe { Self::new(self.0.as_ref().clone()) }
}
}
#[cfg(test)]
mod test {
use super::*;
@ -136,6 +142,19 @@ mod test {
assert_eq!(initial_mem_info.free_size, final_info.free_size)
}
#[test]
fn clone_object_in_lv_mem() {
crate::lvgl_init();
let v1 = Box::new(5);
let v2 = v1.clone();
// Ensure that the two objects have identical values.
assert_eq!(*v1, *v2);
// They should have different memory addresses, however.
assert_ne!(v1.into_raw() as usize, v2.into_raw() as usize);
}
fn mem_info() -> lvgl_sys::lv_mem_monitor_t {
let mut info = lvgl_sys::lv_mem_monitor_t {
total_size: 0,

View file

@ -112,23 +112,25 @@ impl<S> TryFrom<lvgl_sys::lv_event_t> for Event<S> {
type Error = ();
fn try_from(value: u8) -> Result<Self, Self::Error> {
const LV_EVENT_PRESSED: u32 = lvgl_sys::LV_EVENT_PRESSED as u32;
const LV_EVENT_PRESSING: u32 = lvgl_sys::LV_EVENT_PRESSING as u32;
const LV_EVENT_PRESS_LOST: u32 = lvgl_sys::LV_EVENT_PRESS_LOST as u32;
const LV_EVENT_SHORT_CLICKED: u32 = lvgl_sys::LV_EVENT_SHORT_CLICKED as u32;
const LV_EVENT_CLICKED: u32 = lvgl_sys::LV_EVENT_CLICKED as u32;
const LV_EVENT_LONG_PRESSED: u32 = lvgl_sys::LV_EVENT_LONG_PRESSED as u32;
const LV_EVENT_LONG_PRESSED_REPEAT: u32 = lvgl_sys::LV_EVENT_LONG_PRESSED_REPEAT as u32;
const LV_EVENT_RELEASED: u32 = lvgl_sys::LV_EVENT_RELEASED as u32;
match value as u32 {
lvgl_sys::LV_EVENT_PRESSED => Ok(Event::Pressed),
lvgl_sys::LV_EVENT_PRESSING => Ok(Event::Pressing),
lvgl_sys::LV_EVENT_PRESS_LOST => Ok(Event::PressLost),
lvgl_sys::LV_EVENT_SHORT_CLICKED => Ok(Event::ShortClicked),
lvgl_sys::LV_EVENT_CLICKED => Ok(Event::Clicked),
lvgl_sys::LV_EVENT_LONG_PRESSED => Ok(Event::LongPressed),
lvgl_sys::LV_EVENT_LONG_PRESSED_REPEAT => Ok(Event::LongPressedRepeat),
lvgl_sys::LV_EVENT_RELEASED => Ok(Event::Released),
LV_EVENT_PRESSED => Ok(Event::Pressed),
LV_EVENT_PRESSING => Ok(Event::Pressing),
LV_EVENT_PRESS_LOST => Ok(Event::PressLost),
LV_EVENT_SHORT_CLICKED => Ok(Event::ShortClicked),
LV_EVENT_CLICKED => Ok(Event::Clicked),
LV_EVENT_LONG_PRESSED => Ok(Event::LongPressed),
LV_EVENT_LONG_PRESSED_REPEAT => Ok(Event::LongPressedRepeat),
LV_EVENT_RELEASED => Ok(Event::Released),
_ => Err(()),
// _ => {
// if let Ok(special_event_type) = S::try_from(value) {
// Ok(Event::Special(special_event_type))
// } else {
// Err(())
// }
// }
}
}
}
@ -201,9 +203,9 @@ pub enum Align {
OutRightBottom,
}
impl Into<u8> for Align {
fn into(self) -> u8 {
let native = match self {
impl From<Align> for u8 {
fn from(self_: Align) -> u8 {
let native = match self_ {
Align::Center => lvgl_sys::LV_ALIGN_CENTER,
Align::InTopLeft => lvgl_sys::LV_ALIGN_IN_TOP_LEFT,
Align::InTopMid => lvgl_sys::LV_ALIGN_IN_TOP_MID,
@ -247,7 +249,6 @@ impl From<Animation> for lvgl_sys::lv_anim_enable_t {
#[cfg(test)]
mod test {
use super::*;
use lvgl_sys;
#[test]
fn color_properties_accessible() {

View file

@ -6,9 +6,9 @@ use core::ptr;
use core::ptr::NonNull;
use core::sync::atomic::{AtomicBool, Ordering};
use core::time::Duration;
use embedded_graphics::pixelcolor::PixelColor;
use embedded_graphics::draw_target::DrawTarget;
use embedded_graphics::prelude::*;
use embedded_graphics::{drawable, DrawTarget};
use embedded_graphics::{pixelcolor::PixelColor, Pixel};
// There can only be a single reference to LVGL library.
static LVGL_IN_USE: AtomicBool = AtomicBool::new(false);
@ -20,7 +20,7 @@ pub(crate) const BUF_SIZE: usize = lvgl_sys::LV_HOR_RES_MAX as usize * REFRESH_B
pub struct UI<T, C>
where
T: DrawTarget<C>,
T: DrawTarget<Color = C>,
C: PixelColor + From<Color>,
{
// LVGL is not thread-safe by default.
@ -32,14 +32,14 @@ where
// LVGL does not use thread locals.
unsafe impl<T, C> Send for UI<T, C>
where
T: DrawTarget<C>,
T: DrawTarget<Color = C>,
C: PixelColor + From<Color>,
{
}
impl<T, C> UI<T, C>
where
T: DrawTarget<C>,
T: DrawTarget<Color = C>,
C: PixelColor + From<Color>,
{
pub fn init() -> LvResult<Self> {
@ -135,7 +135,7 @@ where
pub(crate) struct DisplayUserData<T, C>
where
T: DrawTarget<C>,
T: DrawTarget<Color = C>,
C: PixelColor + From<Color>,
{
display: T,
@ -147,7 +147,7 @@ unsafe extern "C" fn display_callback_wrapper<T, C>(
area: *const lvgl_sys::lv_area_t,
color_p: *mut lvgl_sys::lv_color_t,
) where
T: DrawTarget<C>,
T: DrawTarget<Color = C>,
C: PixelColor + From<Color>,
{
// In the `std` world we would make sure to capture panics here and make them not escape across
@ -178,7 +178,7 @@ fn display_flush<T, C>(
color_p: *mut lvgl_sys::lv_color_t,
) -> Result<(), T::Error>
where
T: DrawTarget<C>,
T: DrawTarget<Color = C>,
C: PixelColor + From<Color>,
{
let ys = y1..=y2;
@ -187,17 +187,14 @@ where
// We use iterators here to ensure that the Rust compiler can apply all possible
// optimizations at compile time.
let pixels = ys
.enumerate()
.map(|(iy, y)| {
let pixels = ys.enumerate().flat_map(|(iy, y)| {
xs.clone().map(move |(ix, x)| {
let color_len = x_len * iy + ix;
let lv_color = unsafe { *color_p.add(color_len) };
let raw_color = Color::from_raw(lv_color);
drawable::Pixel(Point::new(x as i32, y as i32), raw_color.into())
Pixel(Point::new(x as i32, y as i32), raw_color.into())
})
})
.flatten();
});
Ok(display.draw_iter(pixels)?)
display.draw_iter(pixels)
}