Support running on embedded

This commit is contained in:
Rafael Caricio 2020-05-30 16:31:01 +02:00
parent af43dc2cf1
commit 47ec536a10
5 changed files with 180 additions and 108 deletions

View file

@ -60,6 +60,7 @@ fn main() {
cfg.define("LV_CONF_INCLUDE_SIMPLE", Some("1")) cfg.define("LV_CONF_INCLUDE_SIMPLE", Some("1"))
.include(&vendor_src) .include(&vendor_src)
.include(&vendor) .include(&vendor)
.file("string.c")
.warnings(false) .warnings(false)
.include(&lv_config_dir) .include(&lv_config_dir)
.compile("lvgl"); .compile("lvgl");

View file

@ -117,9 +117,10 @@ pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 27; pub const __GLIBC_MINOR__: u32 = 27;
pub const _SYS_CDEFS_H: u32 = 1; pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1; pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __WORDSIZE: u32 = 64; pub const __WORDSIZE: u32 = 32;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; pub const __WORDSIZE32_SIZE_ULONG: u32 = 0;
pub const __SYSCALL_WORDSIZE: u32 = 64; pub const __WORDSIZE32_PTRDIFF_LONG: u32 = 0;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1; pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const __GLIBC_USE_LIB_EXT2: u32 = 0; pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
@ -127,9 +128,7 @@ pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
pub const _BITS_TYPES_H: u32 = 1; pub const _BITS_TYPES_H: u32 = 1;
pub const _BITS_TYPESIZES_H: u32 = 1; pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 0;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024; pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_WCHAR_H: u32 = 1; pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1; pub const _BITS_STDINT_INTN_H: u32 = 1;
@ -153,22 +152,22 @@ pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535; pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295; pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128; pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808; pub const INT_FAST16_MIN: i32 = -2147483648;
pub const INT_FAST32_MIN: i64 = -9223372036854775808; pub const INT_FAST32_MIN: i32 = -2147483648;
pub const INT_FAST8_MAX: u32 = 127; pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807; pub const INT_FAST16_MAX: u32 = 2147483647;
pub const INT_FAST32_MAX: u64 = 9223372036854775807; pub const INT_FAST32_MAX: u32 = 2147483647;
pub const UINT_FAST8_MAX: u32 = 255; pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1; pub const UINT_FAST16_MAX: u32 = 4294967295;
pub const UINT_FAST32_MAX: i32 = -1; pub const UINT_FAST32_MAX: u32 = 4294967295;
pub const INTPTR_MIN: i64 = -9223372036854775808; pub const INTPTR_MIN: i32 = -2147483648;
pub const INTPTR_MAX: u64 = 9223372036854775807; pub const INTPTR_MAX: u32 = 2147483647;
pub const UINTPTR_MAX: i32 = -1; pub const UINTPTR_MAX: u32 = 4294967295;
pub const PTRDIFF_MIN: i64 = -9223372036854775808; pub const PTRDIFF_MIN: i32 = -2147483648;
pub const PTRDIFF_MAX: u64 = 9223372036854775807; pub const PTRDIFF_MAX: u32 = 2147483647;
pub const SIG_ATOMIC_MIN: i32 = -2147483648; pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647; pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1; pub const SIZE_MAX: u32 = 4294967295;
pub const WINT_MIN: u32 = 0; pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295; pub const WINT_MAX: u32 = 4294967295;
pub const LV_HOR_RES_MAX: u32 = 240; pub const LV_HOR_RES_MAX: u32 = 240;
@ -397,21 +396,21 @@ pub type __int16_t = cty::c_short;
pub type __uint16_t = cty::c_ushort; pub type __uint16_t = cty::c_ushort;
pub type __int32_t = cty::c_int; pub type __int32_t = cty::c_int;
pub type __uint32_t = cty::c_uint; pub type __uint32_t = cty::c_uint;
pub type __int64_t = cty::c_long; pub type __int64_t = cty::c_longlong;
pub type __uint64_t = cty::c_ulong; pub type __uint64_t = cty::c_ulonglong;
pub type __quad_t = cty::c_long; pub type __quad_t = cty::c_longlong;
pub type __u_quad_t = cty::c_ulong; pub type __u_quad_t = cty::c_ulonglong;
pub type __intmax_t = cty::c_long; pub type __intmax_t = cty::c_longlong;
pub type __uintmax_t = cty::c_ulong; pub type __uintmax_t = cty::c_ulonglong;
pub type __dev_t = cty::c_ulong; pub type __dev_t = __u_quad_t;
pub type __uid_t = cty::c_uint; pub type __uid_t = cty::c_uint;
pub type __gid_t = cty::c_uint; pub type __gid_t = cty::c_uint;
pub type __ino_t = cty::c_ulong; pub type __ino_t = cty::c_ulong;
pub type __ino64_t = cty::c_ulong; pub type __ino64_t = __u_quad_t;
pub type __mode_t = cty::c_uint; pub type __mode_t = cty::c_uint;
pub type __nlink_t = cty::c_ulong; pub type __nlink_t = cty::c_uint;
pub type __off_t = cty::c_long; pub type __off_t = cty::c_long;
pub type __off64_t = cty::c_long; pub type __off64_t = __quad_t;
pub type __pid_t = cty::c_int; pub type __pid_t = cty::c_int;
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
@ -420,7 +419,7 @@ pub struct __fsid_t {
} }
pub type __clock_t = cty::c_long; pub type __clock_t = cty::c_long;
pub type __rlim_t = cty::c_ulong; pub type __rlim_t = cty::c_ulong;
pub type __rlim64_t = cty::c_ulong; pub type __rlim64_t = __u_quad_t;
pub type __id_t = cty::c_uint; pub type __id_t = cty::c_uint;
pub type __time_t = cty::c_long; pub type __time_t = cty::c_long;
pub type __useconds_t = cty::c_uint; pub type __useconds_t = cty::c_uint;
@ -431,36 +430,36 @@ pub type __clockid_t = cty::c_int;
pub type __timer_t = *mut cty::c_void; pub type __timer_t = *mut cty::c_void;
pub type __blksize_t = cty::c_long; pub type __blksize_t = cty::c_long;
pub type __blkcnt_t = cty::c_long; pub type __blkcnt_t = cty::c_long;
pub type __blkcnt64_t = cty::c_long; pub type __blkcnt64_t = __quad_t;
pub type __fsblkcnt_t = cty::c_ulong; pub type __fsblkcnt_t = cty::c_ulong;
pub type __fsblkcnt64_t = cty::c_ulong; pub type __fsblkcnt64_t = __u_quad_t;
pub type __fsfilcnt_t = cty::c_ulong; pub type __fsfilcnt_t = cty::c_ulong;
pub type __fsfilcnt64_t = cty::c_ulong; pub type __fsfilcnt64_t = __u_quad_t;
pub type __fsword_t = cty::c_long; pub type __fsword_t = cty::c_int;
pub type __ssize_t = cty::c_long; pub type __ssize_t = cty::c_int;
pub type __syscall_slong_t = cty::c_long; pub type __syscall_slong_t = cty::c_long;
pub type __syscall_ulong_t = cty::c_ulong; pub type __syscall_ulong_t = cty::c_ulong;
pub type __loff_t = __off64_t; pub type __loff_t = __off64_t;
pub type __caddr_t = *mut cty::c_char; pub type __caddr_t = *mut cty::c_char;
pub type __intptr_t = cty::c_long; pub type __intptr_t = cty::c_int;
pub type __socklen_t = cty::c_uint; pub type __socklen_t = cty::c_uint;
pub type __sig_atomic_t = cty::c_int; pub type __sig_atomic_t = cty::c_int;
pub type int_least8_t = cty::c_schar; pub type int_least8_t = cty::c_schar;
pub type int_least16_t = cty::c_short; pub type int_least16_t = cty::c_short;
pub type int_least32_t = cty::c_int; pub type int_least32_t = cty::c_int;
pub type int_least64_t = cty::c_long; pub type int_least64_t = cty::c_longlong;
pub type uint_least8_t = cty::c_uchar; pub type uint_least8_t = cty::c_uchar;
pub type uint_least16_t = cty::c_ushort; pub type uint_least16_t = cty::c_ushort;
pub type uint_least32_t = cty::c_uint; pub type uint_least32_t = cty::c_uint;
pub type uint_least64_t = cty::c_ulong; pub type uint_least64_t = cty::c_ulonglong;
pub type int_fast8_t = cty::c_schar; pub type int_fast8_t = cty::c_schar;
pub type int_fast16_t = cty::c_long; pub type int_fast16_t = cty::c_int;
pub type int_fast32_t = cty::c_long; pub type int_fast32_t = cty::c_int;
pub type int_fast64_t = cty::c_long; pub type int_fast64_t = cty::c_longlong;
pub type uint_fast8_t = cty::c_uchar; pub type uint_fast8_t = cty::c_uchar;
pub type uint_fast16_t = cty::c_ulong; pub type uint_fast16_t = cty::c_uint;
pub type uint_fast32_t = cty::c_ulong; pub type uint_fast32_t = cty::c_uint;
pub type uint_fast64_t = cty::c_ulong; pub type uint_fast64_t = cty::c_ulonglong;
pub type intmax_t = __intmax_t; pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t; pub type uintmax_t = __uintmax_t;
pub type lv_coord_t = i16; pub type lv_coord_t = i16;
@ -477,22 +476,20 @@ pub struct _silence_gcc_warning {
_unused: [u8; 0], _unused: [u8; 0],
} }
pub type lv_log_level_t = i8; pub type lv_log_level_t = i8;
pub type size_t = cty::c_ulong; pub type size_t = cty::c_uint;
pub type wchar_t = cty::c_int; pub type wchar_t = cty::c_uint;
#[repr(C)] #[repr(C)]
#[repr(align(16))]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct max_align_t { pub struct max_align_t {
pub __clang_max_align_nonce1: cty::c_longlong, pub __clang_max_align_nonce1: cty::c_longlong,
pub __bindgen_padding_0: u64, pub __clang_max_align_nonce2: f64,
pub __clang_max_align_nonce2: u128,
} }
pub const LV_RES_INV: _bindgen_ty_1 = 0; pub const LV_RES_INV: _bindgen_ty_1 = 0;
pub const LV_RES_OK: _bindgen_ty_1 = 1; pub const LV_RES_OK: _bindgen_ty_1 = 1;
#[doc = " LittlevGL error codes."] #[doc = " LittlevGL error codes."]
pub type _bindgen_ty_1 = u32; pub type _bindgen_ty_1 = u32;
pub type lv_res_t = u8; pub type lv_res_t = u8;
pub type lv_uintptr_t = u64; pub type lv_uintptr_t = u32;
#[doc = " Heap information structure."] #[doc = " Heap information structure."]
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
@ -688,7 +685,7 @@ pub struct _lv_task_t {
#[doc = "< Custom user data"] #[doc = "< Custom user data"]
pub user_data: *mut cty::c_void, pub user_data: *mut cty::c_void,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl _lv_task_t { impl _lv_task_t {
#[inline] #[inline]
@ -1122,14 +1119,14 @@ extern "C" {
pub fn memcpy( pub fn memcpy(
__dest: *mut cty::c_void, __dest: *mut cty::c_void,
__src: *const cty::c_void, __src: *const cty::c_void,
__n: cty::c_ulong, __n: cty::c_uint,
) -> *mut cty::c_void; ) -> *mut cty::c_void;
} }
extern "C" { extern "C" {
pub fn memmove( pub fn memmove(
__dest: *mut cty::c_void, __dest: *mut cty::c_void,
__src: *const cty::c_void, __src: *const cty::c_void,
__n: cty::c_ulong, __n: cty::c_uint,
) -> *mut cty::c_void; ) -> *mut cty::c_void;
} }
extern "C" { extern "C" {
@ -1141,17 +1138,17 @@ extern "C" {
) -> *mut cty::c_void; ) -> *mut cty::c_void;
} }
extern "C" { extern "C" {
pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; pub fn memset(__s: *mut cty::c_void, __c: cty::c_int, __n: cty::c_uint) -> *mut cty::c_void;
} }
extern "C" { extern "C" {
pub fn memcmp( pub fn memcmp(
__s1: *const cty::c_void, __s1: *const cty::c_void,
__s2: *const cty::c_void, __s2: *const cty::c_void,
__n: cty::c_ulong, __n: cty::c_uint,
) -> cty::c_int; ) -> cty::c_int;
} }
extern "C" { extern "C" {
pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_ulong) -> *mut cty::c_void; pub fn memchr(__s: *const cty::c_void, __c: cty::c_int, __n: cty::c_uint) -> *mut cty::c_void;
} }
extern "C" { extern "C" {
pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char; pub fn strcpy(__dest: *mut cty::c_char, __src: *const cty::c_char) -> *mut cty::c_char;
@ -1160,7 +1157,7 @@ extern "C" {
pub fn strncpy( pub fn strncpy(
__dest: *mut cty::c_char, __dest: *mut cty::c_char,
__src: *const cty::c_char, __src: *const cty::c_char,
__n: cty::c_ulong, __n: cty::c_uint,
) -> *mut cty::c_char; ) -> *mut cty::c_char;
} }
extern "C" { extern "C" {
@ -1170,7 +1167,7 @@ extern "C" {
pub fn strncat( pub fn strncat(
__dest: *mut cty::c_char, __dest: *mut cty::c_char,
__src: *const cty::c_char, __src: *const cty::c_char,
__n: cty::c_ulong, __n: cty::c_uint,
) -> *mut cty::c_char; ) -> *mut cty::c_char;
} }
extern "C" { extern "C" {
@ -1180,7 +1177,7 @@ extern "C" {
pub fn strncmp( pub fn strncmp(
__s1: *const cty::c_char, __s1: *const cty::c_char,
__s2: *const cty::c_char, __s2: *const cty::c_char,
__n: cty::c_ulong, __n: cty::c_uint,
) -> cty::c_int; ) -> cty::c_int;
} }
extern "C" { extern "C" {
@ -1190,8 +1187,8 @@ extern "C" {
pub fn strxfrm( pub fn strxfrm(
__dest: *mut cty::c_char, __dest: *mut cty::c_char,
__src: *const cty::c_char, __src: *const cty::c_char,
__n: cty::c_ulong, __n: cty::c_uint,
) -> cty::c_ulong; ) -> cty::c_uint;
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
@ -1223,7 +1220,7 @@ extern "C" {
pub fn strdup(__s: *const cty::c_char) -> *mut cty::c_char; pub fn strdup(__s: *const cty::c_char) -> *mut cty::c_char;
} }
extern "C" { extern "C" {
pub fn strndup(__string: *const cty::c_char, __n: cty::c_ulong) -> *mut cty::c_char; pub fn strndup(__string: *const cty::c_char, __n: cty::c_uint) -> *mut cty::c_char;
} }
extern "C" { extern "C" {
pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; pub fn strchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char;
@ -1232,10 +1229,10 @@ extern "C" {
pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; pub fn strrchr(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char;
} }
extern "C" { extern "C" {
pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_ulong; pub fn strcspn(__s: *const cty::c_char, __reject: *const cty::c_char) -> cty::c_uint;
} }
extern "C" { extern "C" {
pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_ulong; pub fn strspn(__s: *const cty::c_char, __accept: *const cty::c_char) -> cty::c_uint;
} }
extern "C" { extern "C" {
pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char; pub fn strpbrk(__s: *const cty::c_char, __accept: *const cty::c_char) -> *mut cty::c_char;
@ -1262,7 +1259,7 @@ extern "C" {
) -> *mut cty::c_char; ) -> *mut cty::c_char;
} }
extern "C" { extern "C" {
pub fn strlen(__s: *const cty::c_char) -> cty::c_ulong; pub fn strlen(__s: *const cty::c_char) -> cty::c_uint;
} }
extern "C" { extern "C" {
pub fn strnlen(__string: *const cty::c_char, __maxlen: size_t) -> size_t; pub fn strnlen(__string: *const cty::c_char, __maxlen: size_t) -> size_t;
@ -1282,17 +1279,14 @@ extern "C" {
pub fn strerror_l(__errnum: cty::c_int, __l: locale_t) -> *mut cty::c_char; pub fn strerror_l(__errnum: cty::c_int, __l: locale_t) -> *mut cty::c_char;
} }
extern "C" { extern "C" {
pub fn bcmp( pub fn bcmp(__s1: *const cty::c_void, __s2: *const cty::c_void, __n: cty::c_uint)
__s1: *const cty::c_void, -> cty::c_int;
__s2: *const cty::c_void,
__n: cty::c_ulong,
) -> cty::c_int;
} }
extern "C" { extern "C" {
pub fn bcopy(__src: *const cty::c_void, __dest: *mut cty::c_void, __n: size_t); pub fn bcopy(__src: *const cty::c_void, __dest: *mut cty::c_void, __n: size_t);
} }
extern "C" { extern "C" {
pub fn bzero(__s: *mut cty::c_void, __n: cty::c_ulong); pub fn bzero(__s: *mut cty::c_void, __n: cty::c_uint);
} }
extern "C" { extern "C" {
pub fn index(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char; pub fn index(__s: *const cty::c_char, __c: cty::c_int) -> *mut cty::c_char;
@ -1316,7 +1310,7 @@ extern "C" {
pub fn strncasecmp( pub fn strncasecmp(
__s1: *const cty::c_char, __s1: *const cty::c_char,
__s2: *const cty::c_char, __s2: *const cty::c_char,
__n: cty::c_ulong, __n: cty::c_uint,
) -> cty::c_int; ) -> cty::c_int;
} }
extern "C" { extern "C" {
@ -1363,7 +1357,7 @@ extern "C" {
pub fn stpncpy( pub fn stpncpy(
__dest: *mut cty::c_char, __dest: *mut cty::c_char,
__src: *const cty::c_char, __src: *const cty::c_char,
__n: cty::c_ulong, __n: cty::c_uint,
) -> *mut cty::c_char; ) -> *mut cty::c_char;
} }
#[doc = " Represents a point on the screen."] #[doc = " Represents a point on the screen."]
@ -1825,14 +1819,14 @@ pub struct _lv_indev_proc_t {
#[doc = "< Long press repeat time stamp"] #[doc = "< Long press repeat time stamp"]
pub longpr_rep_timestamp: u32, pub longpr_rep_timestamp: u32,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub union _lv_indev_proc_t__bindgen_ty_1 { pub union _lv_indev_proc_t__bindgen_ty_1 {
pub pointer: _lv_indev_proc_t__bindgen_ty_1__bindgen_ty_1, pub pointer: _lv_indev_proc_t__bindgen_ty_1__bindgen_ty_1,
pub keypad: _lv_indev_proc_t__bindgen_ty_1__bindgen_ty_2, pub keypad: _lv_indev_proc_t__bindgen_ty_1__bindgen_ty_2,
_bindgen_union_align: [u64; 7usize], _bindgen_union_align: [u32; 9usize],
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
@ -1849,7 +1843,7 @@ pub struct _lv_indev_proc_t__bindgen_ty_1__bindgen_ty_1 {
pub last_obj: *mut _lv_obj_t, pub last_obj: *mut _lv_obj_t,
pub last_pressed: *mut _lv_obj_t, pub last_pressed: *mut _lv_obj_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl _lv_indev_proc_t__bindgen_ty_1__bindgen_ty_1 { impl _lv_indev_proc_t__bindgen_ty_1__bindgen_ty_1 {
#[inline] #[inline]
@ -2254,7 +2248,7 @@ pub struct _lv_anim_t {
#[doc = "< Custom user data"] #[doc = "< Custom user data"]
pub user_data: lv_anim_user_data_t, pub user_data: lv_anim_user_data_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl _lv_anim_t { impl _lv_anim_t {
#[inline] #[inline]
@ -3749,7 +3743,7 @@ pub struct _lv_group_t {
pub style_tmp: lv_style_t, pub style_tmp: lv_style_t,
pub user_data: lv_group_user_data_t, pub user_data: lv_group_user_data_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl _lv_group_t { impl _lv_group_t {
#[inline] #[inline]
@ -4572,7 +4566,6 @@ pub struct lv_font_fmt_txt_kern_pair_t {
pub glyph_ids: *const cty::c_void, pub glyph_ids: *const cty::c_void,
pub values: *const i8, pub values: *const i8,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u32>,
pub __bindgen_padding_0: u32,
} }
impl lv_font_fmt_txt_kern_pair_t { impl lv_font_fmt_txt_kern_pair_t {
#[inline] #[inline]
@ -4760,7 +4753,7 @@ extern "C" {
buffer: *mut cty::c_char, buffer: *mut cty::c_char,
count: size_t, count: size_t,
format: *const cty::c_char, format: *const cty::c_char,
va: *mut __va_list_tag, va: va_list,
) -> cty::c_int; ) -> cty::c_int;
} }
#[doc = "< No layout"] #[doc = "< No layout"]
@ -4981,7 +4974,7 @@ pub struct lv_btn_ext_t {
#[doc = "Styles in each state"] #[doc = "Styles in each state"]
pub styles: [*const lv_style_t; 5usize], pub styles: [*const lv_style_t; 5usize],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl lv_btn_ext_t { impl lv_btn_ext_t {
#[inline] #[inline]
@ -6133,14 +6126,14 @@ pub struct lv_label_ext_t {
pub offset: lv_point_t, pub offset: lv_point_t,
pub anim_speed: u16, pub anim_speed: u16,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>,
pub __bindgen_padding_0: [u16; 3usize], pub __bindgen_padding_0: u16,
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub union lv_label_ext_t__bindgen_ty_1 { pub union lv_label_ext_t__bindgen_ty_1 {
pub tmp_ptr: *mut cty::c_char, pub tmp_ptr: *mut cty::c_char,
pub tmp: [cty::c_char; 4usize], pub tmp: [cty::c_char; 4usize],
_bindgen_union_align: u64, _bindgen_union_align: u32,
} }
impl lv_label_ext_t { impl lv_label_ext_t {
#[inline] #[inline]
@ -6441,7 +6434,7 @@ pub struct lv_img_ext_t {
pub w: lv_coord_t, pub w: lv_coord_t,
pub h: lv_coord_t, pub h: lv_coord_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl lv_img_ext_t { impl lv_img_ext_t {
#[inline] #[inline]
@ -6574,7 +6567,7 @@ pub struct lv_line_ext_t {
pub point_array: *const lv_point_t, pub point_array: *const lv_point_t,
pub point_num: u16, pub point_num: u16,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 5usize], pub __bindgen_padding_0: u8,
} }
impl lv_line_ext_t { impl lv_line_ext_t {
#[inline] #[inline]
@ -6689,7 +6682,7 @@ pub struct lv_page_ext_t {
pub edge_flash: lv_page_ext_t__bindgen_ty_2, pub edge_flash: lv_page_ext_t__bindgen_ty_2,
pub anim_time: u16, pub anim_time: u16,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 5usize], pub __bindgen_padding_0: u8,
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
@ -6698,7 +6691,7 @@ pub struct lv_page_ext_t__bindgen_ty_1 {
pub hor_area: lv_area_t, pub hor_area: lv_area_t,
pub ver_area: lv_area_t, pub ver_area: lv_area_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl lv_page_ext_t__bindgen_ty_1 { impl lv_page_ext_t__bindgen_ty_1 {
#[inline] #[inline]
@ -6763,7 +6756,7 @@ pub struct lv_page_ext_t__bindgen_ty_2 {
pub state: lv_anim_value_t, pub state: lv_anim_value_t,
pub style: *const lv_style_t, pub style: *const lv_style_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl lv_page_ext_t__bindgen_ty_2 { impl lv_page_ext_t__bindgen_ty_2 {
#[inline] #[inline]
@ -8271,7 +8264,7 @@ pub struct lv_slider_ext_t {
pub style_knob: *const lv_style_t, pub style_knob: *const lv_style_t,
pub drag_value: i16, pub drag_value: i16,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 5usize], pub __bindgen_padding_0: u8,
} }
impl lv_slider_ext_t { impl lv_slider_ext_t {
#[inline] #[inline]
@ -8645,7 +8638,7 @@ pub struct lv_kb_ext_t {
pub ta: *mut lv_obj_t, pub ta: *mut lv_obj_t,
pub mode: lv_kb_mode_t, pub mode: lv_kb_mode_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u16; 3usize], pub __bindgen_padding_0: u16,
} }
impl lv_kb_ext_t { impl lv_kb_ext_t {
#[inline] #[inline]
@ -8976,7 +8969,7 @@ pub type lv_roller_mode_t = u8;
pub struct lv_roller_ext_t { pub struct lv_roller_ext_t {
pub ddlist: lv_ddlist_ext_t, pub ddlist: lv_ddlist_ext_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl lv_roller_ext_t { impl lv_roller_ext_t {
#[inline] #[inline]
@ -9108,7 +9101,7 @@ pub struct lv_ta_ext_t {
pub pwd_show_time: u16, pub pwd_show_time: u16,
pub cursor: lv_ta_ext_t__bindgen_ty_1, pub cursor: lv_ta_ext_t__bindgen_ty_1,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
@ -9120,7 +9113,7 @@ pub struct lv_ta_ext_t__bindgen_ty_1 {
pub area: lv_area_t, pub area: lv_area_t,
pub txt_byte_pos: u16, pub txt_byte_pos: u16,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl lv_ta_ext_t__bindgen_ty_1 { impl lv_ta_ext_t__bindgen_ty_1 {
#[inline] #[inline]
@ -9886,7 +9879,7 @@ pub struct lv_tabview_ext_t {
pub tab_cnt: u16, pub tab_cnt: u16,
pub anim_time: u16, pub anim_time: u16,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 5usize], pub __bindgen_padding_0: u8,
} }
impl lv_tabview_ext_t { impl lv_tabview_ext_t {
#[inline] #[inline]
@ -10125,7 +10118,7 @@ pub struct lv_tileview_ext_t {
pub anim_time: u16, pub anim_time: u16,
pub act_id: lv_point_t, pub act_id: lv_point_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
pub __bindgen_padding_0: [u8; 7usize], pub __bindgen_padding_0: [u8; 3usize],
} }
impl lv_tileview_ext_t { impl lv_tileview_ext_t {
#[inline] #[inline]
@ -11080,7 +11073,7 @@ pub struct lv_spinbox_ext_t {
pub range_min: i32, pub range_min: i32,
pub step: i32, pub step: i32,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>, pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>,
pub __bindgen_padding_0: [u16; 3usize], pub __bindgen_padding_0: u16,
} }
impl lv_spinbox_ext_t { impl lv_spinbox_ext_t {
#[inline] #[inline]
@ -11272,12 +11265,9 @@ extern "C" {
pub struct __locale_data { pub struct __locale_data {
pub _address: u8, pub _address: u8,
} }
pub type __builtin_va_list = [__va_list_tag; 1usize]; pub type __builtin_va_list = __va_list;
#[repr(C)] #[repr(C)]
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct __va_list_tag { pub struct __va_list {
pub gp_offset: cty::c_uint, pub __ap: *mut cty::c_void,
pub fp_offset: cty::c_uint,
pub overflow_arg_area: *mut cty::c_void,
pub reg_save_area: *mut cty::c_void,
} }

68
lvgl-sys/string.c Normal file
View file

@ -0,0 +1,68 @@
// SPDX-License-Identifier: GPL-2.0
/*
* linux/lib/string.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#include <string.h>
size_t strspn(const char *s, const char *accept)
{
const char *p;
const char *a;
size_t count = 0;
for (p = s; *p != '\0'; ++p) {
for (a = accept; *a != '\0'; ++a) {
if (*p == *a)
break;
}
if (*a == '\0')
return count;
++count;
}
return count;
}
size_t strcspn(const char *s, const char *reject)
{
const char *p;
const char *r;
size_t count = 0;
for (p = s; *p != '\0'; ++p) {
for (r = reject; *r != '\0'; ++r) {
if (*p == *r)
return count;
}
++count;
}
return count;
}
size_t strlen(const char *s)
{
const char *sc;
for (sc = s; *sc != '\0'; ++sc)
/* nothing */;
return sc - s;
}
char *strchr(const char *s, int c)
{
for (; *s != (char)c; ++s)
if (*s == '\0')
return NULL;
return (char *)s;
}
char *strcpy(char *dest, const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}

View file

@ -24,19 +24,22 @@ impl DisplayDriver {
Box::new(MaybeUninit::<lvgl_sys::lv_disp_buf_t>::uninit().assume_init()); Box::new(MaybeUninit::<lvgl_sys::lv_disp_buf_t>::uninit().assume_init());
// Declare a buffer for the refresh rate // Declare a buffer for the refresh rate
let refresh_buffer = Box::new( let refresh_buffer =
MaybeUninit::< Box::new(
[MaybeUninit<lvgl_sys::lv_color_t>; lvgl_sys::LV_HOR_RES_MAX as usize * 10], MaybeUninit::<
>::uninit() [MaybeUninit<lvgl_sys::lv_color_t>; lvgl_sys::LV_HOR_RES_MAX as usize],
.assume_init(), >::uninit()
); .assume_init(),
);
let refresh_buffer_len = refresh_buffer.len();
// Initialize the display buffer // Initialize the display buffer
lvgl_sys::lv_disp_buf_init( lvgl_sys::lv_disp_buf_init(
display_buffer.as_mut(), display_buffer.as_mut(),
Box::into_raw(refresh_buffer) as *mut cty::c_void, Box::into_raw(refresh_buffer) as *mut cty::c_void,
core::ptr::null_mut(), core::ptr::null_mut(),
(lvgl_sys::LV_HOR_RES_MAX * 10) as u32, refresh_buffer_len as u32,
); );
// Descriptor of a display driver // Descriptor of a display driver

View file

@ -232,6 +232,16 @@ impl Style {
pub fn set_text_font(&mut self, font: &lvgl_sys::lv_font_t) { pub fn set_text_font(&mut self, font: &lvgl_sys::lv_font_t) {
self.raw.text.font = font; self.raw.text.font = font;
} }
/// Body radius for rounded corners.
pub fn set_body_radius(&mut self, radius: i16) {
self.raw.body.radius = radius;
}
/// Border color.
pub fn set_body_border_color(&mut self, color: Color) {
self.raw.body.border.color = color.raw;
}
} }
impl Clone for Style { impl Clone for Style {