use
super::*;
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage, Align>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
storage: Storage,
align: [Align; 0],
}
impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
#[inline]
pub fn new(storage: Storage) -> Self {
Self { storage, align: [] }
}
#[inline]
pub fn get_bit(&self, index: usize) -> bool {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = self.storage.as_ref()[byte_index];
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
byte & mask == mask
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = &mut self.storage.as_mut()[byte_index];
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
if val {
*byte |= mask;
} else {
*byte &= !mask;
}
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
let mut val = 0;
for i in 0..(bit_width as usize) {
if self.get_bit(i + bit_offset) {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
self.set_bit(index + bit_offset, val_bit_is_set);
}
}
}
pub const LV_INDEV_DEF_READ_PERIOD: u32 = 30;
pub const LV_INDEV_DEF_DRAG_LIMIT: u32 = 10;
pub const LV_INDEV_DEF_DRAG_THROW: u32 = 20;
pub const LV_INDEV_DEF_LONG_PRESS_TIME: u32 = 400;
pub const LV_INDEV_DEF_LONG_PRESS_REP_TIME: u32 = 100;
pub const LV_INDEV_DEF_GESTURE_LIMIT: u32 = 50;
pub const LV_INDEV_DEF_GESTURE_MIN_VELOCITY: u32 = 3;
#[repr(C)]
#[repr(align(2))]
#[derive(Default, Copy, Clone)]
pub struct lv_color16_t__bindgen_ty_1 {
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u8>,
}
impl lv_color16_t__bindgen_ty_1 {
#[inline]
pub fn green_h(&self) -> u16 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 3u8) as u16) }
}
#[inline]
pub fn set_green_h(&mut self, val: u16) {
unsafe {
let val: u16 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 3u8, val as u64)
}
}
#[inline]
pub fn red(&self) -> u16 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(3usize, 5u8) as u16) }
}
#[inline]
pub fn set_red(&mut self, val: u16) {
unsafe {
let val: u16 = ::core::mem::transmute(val);
self._bitfield_1.set(3usize, 5u8, val as u64)
}
}
#[inline]
pub fn blue(&self) -> u16 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(8usize, 5u8) as u16) }
}
#[inline]
pub fn set_blue(&mut self, val: u16) {
unsafe {
let val: u16 = ::core::mem::transmute(val);
self._bitfield_1.set(8usize, 5u8, val as u64)
}
}
#[inline]
pub fn green_l(&self) -> u16 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(13usize, 3u8) as u16) }
}
#[inline]
pub fn set_green_l(&mut self, val: u16) {
unsafe {
let val: u16 = ::core::mem::transmute(val);
self._bitfield_1.set(13usize, 3u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
green_h: u16,
red: u16,
blue: u16,
green_l: u16,
) -> __BindgenBitfieldUnit<[u8; 2usize], u8> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u8> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 3u8, {
let green_h: u16 = unsafe { ::core::mem::transmute(green_h) };
green_h as u64
});
__bindgen_bitfield_unit.set(3usize, 5u8, {
let red: u16 = unsafe { ::core::mem::transmute(red) };
red as u64
});
__bindgen_bitfield_unit.set(8usize, 5u8, {
let blue: u16 = unsafe { ::core::mem::transmute(blue) };
blue as u64
});
__bindgen_bitfield_unit.set(13usize, 3u8, {
let green_l: u16 = unsafe { ::core::mem::transmute(green_l) };
green_l as u64
});
__bindgen_bitfield_unit
}
}
#[doc = " Display Driver structure to be registered by HAL"]
#[repr(C)]
pub struct _disp_drv_t {
#[doc = "< Horizontal resolution."]
pub hor_res: lv_coord_t,
#[doc = "< Vertical resolution."]
pub ver_res: lv_coord_t,
#[doc = " Pointer to a buffer initialized with `lv_disp_buf_init()`."]
#[doc = " LVGL will use this buffer(s) to draw the screens contents"]
pub buffer: *mut lv_disp_buf_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize], u16>,
#[doc = " MANDATORY: Write the internal buffer (VDB) to the display. 'lv_disp_flush_ready()' has to be"]
#[doc = " called when finished"]
pub flush_cb: ::core::option::Option<
unsafe extern "C" fn(
disp_drv: *mut _disp_drv_t,
area: *const lv_area_t,
color_p: *mut lv_color_t,
),
>,
#[doc = " OPTIONAL: Extend the invalidated areas to match with the display drivers requirements"]
#[doc = " E.g. round `y` to, 8, 16 ..) on a monochrome display"]
pub rounder_cb: ::core::option::Option<
unsafe extern "C" fn(disp_drv: *mut _disp_drv_t, area: *mut lv_area_t),
>,
#[doc = " OPTIONAL: Set a pixel in a buffer according to the special requirements of the display"]
#[doc = " Can be used for color format not supported in LittelvGL. E.g. 2 bit -> 4 gray scales"]
#[doc = " __Note:__ Much slower then drawing with supported color formats."]
pub set_px_cb: ::core::option::Option<
unsafe extern "C" fn(
disp_drv: *mut _disp_drv_t,
buf: *mut u8,
buf_w: lv_coord_t,
x: lv_coord_t,
y: lv_coord_t,
color: lv_color_t,
opa: lv_opa_t,
),
>,
#[doc = " OPTIONAL: Called after every refresh cycle to tell the rendering and flushing time + the"]
#[doc = " number of flushed pixels"]
pub monitor_cb: ::core::option::Option<
unsafe extern "C" fn(disp_drv: *mut _disp_drv_t, time: u32, px: u32),
>,
#[doc = " OPTIONAL: Called periodically while lvgl waits for operation to be completed."]
#[doc = " For example flushing or GPU"]
#[doc = " User can execute very simple tasks here or yield the task"]
pub wait_cb: ::core::option::Option<unsafe extern "C" fn(disp_drv: *mut _disp_drv_t)>,
#[doc = " OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned"]
pub clean_dcache_cb: ::core::option::Option<unsafe extern "C" fn(disp_drv: *mut _disp_drv_t)>,
#[doc = " OPTIONAL: called to wait while the gpu is working"]
pub gpu_wait_cb: ::core::option::Option<unsafe extern "C" fn(disp_drv: *mut _disp_drv_t)>,
#[doc = " On CHROMA_KEYED images this color will be transparent."]
#[doc = " `LV_COLOR_TRANSP` by default. (lv_conf.h)"]
pub color_chroma_key: lv_color_t,
#[doc = "< Custom display driver user data"]
pub user_data: lv_disp_drv_user_data_t,
}
impl Default for _disp_drv_t {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl _disp_drv_t {
#[inline]
pub fn antialiasing(&self) -> u32 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
}
#[inline]
pub fn set_antialiasing(&mut self, val: u32) {
unsafe {
let val: u32 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 1u8, val as u64)
}
}
#[inline]
pub fn rotated(&self) -> u32 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
}
#[inline]
pub fn set_rotated(&mut self, val: u32) {
unsafe {
let val: u32 = ::core::mem::transmute(val);
self._bitfield_1.set(1usize, 1u8, val as u64)
}
}
#[inline]
pub fn dpi(&self) -> u32 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(2usize, 10u8) as u32) }
}
#[inline]
pub fn set_dpi(&mut self, val: u32) {
unsafe {
let val: u32 = ::core::mem::transmute(val);
self._bitfield_1.set(2usize, 10u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(
antialiasing: u32,
rotated: u32,
dpi: u32,
) -> __BindgenBitfieldUnit<[u8; 2usize], u16> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u16> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 1u8, {
let antialiasing: u32 = unsafe { ::core::mem::transmute(antialiasing) };
antialiasing as u64
});
__bindgen_bitfield_unit.set(1usize, 1u8, {
let rotated: u32 = unsafe { ::core::mem::transmute(rotated) };
rotated as u64
});
__bindgen_bitfield_unit.set(2usize, 10u8, {
let dpi: u32 = unsafe { ::core::mem::transmute(dpi) };
dpi as u64
});
__bindgen_bitfield_unit
}
}
#[doc = " TYPEDEFS"]
#[repr(C)]
pub struct _disp_t {
pub driver: lv_disp_drv_t,
pub refr_task: *mut lv_task_t,
#[doc = " Screens of the display"]
pub scr_ll: lv_ll_t,
#[doc = "< Currently active screen on this display"]
pub act_scr: *mut _lv_obj_t,
#[doc = "< Previous screen. Used during screen animations"]
pub prev_scr: *mut _lv_obj_t,
#[doc = "< @see lv_disp_get_layer_top"]
pub top_layer: *mut _lv_obj_t,
#[doc = "< @see lv_disp_get_layer_sys"]
pub sys_layer: *mut _lv_obj_t,
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>,
#[doc = "< Default display color when screens are transparent"]
pub bg_color: lv_color_t,
#[doc = "< An image source to display as wallpaper"]
pub bg_img: *const ::cty::c_void,
#[doc = "<Opacity of the background color or wallpaper"]
pub bg_opa: lv_opa_t,
#[doc = " Invalidated (marked to redraw) areas"]
pub inv_areas: [lv_area_t; 32usize],
pub inv_area_joined: [u8; 32usize],
pub _bitfield_2: __BindgenBitfieldUnit<[u8; 2usize], u16>,
#[doc = "< Last time there was activity on this display"]
pub last_activity_time: u32,
}
impl Default for _disp_t {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
impl _disp_t {
#[inline]
pub fn del_prev(&self) -> u8 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
}
#[inline]
pub fn set_del_prev(&mut self, val: u8) {
unsafe {
let val: u8 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 1u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(del_prev: u8) -> __BindgenBitfieldUnit<[u8; 1usize], u8> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 1u8, {
let del_prev: u8 = unsafe { ::core::mem::transmute(del_prev) };
del_prev as u64
});
__bindgen_bitfield_unit
}
#[inline]
pub fn inv_p(&self) -> u32 {
unsafe { ::core::mem::transmute(self._bitfield_2.get(0usize, 10u8) as u32) }
}
#[inline]
pub fn set_inv_p(&mut self, val: u32) {
unsafe {
let val: u32 = ::core::mem::transmute(val);
self._bitfield_2.set(0usize, 10u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_2(inv_p: u32) -> __BindgenBitfieldUnit<[u8; 2usize], u16> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize], u16> =
Default::default();
__bindgen_bitfield_unit.set(0usize, 10u8, {
let inv_p: u32 = unsafe { ::core::mem::transmute(inv_p) };
inv_p as u64
});
__bindgen_bitfield_unit
}
}
#[doc = "< Uninitialized state"]
pub const LV_INDEV_TYPE_NONE: _bindgen_ty_16 = 0;
#[doc = "< Touch pad, mouse, external button"]
pub const LV_INDEV_TYPE_POINTER: _bindgen_ty_16 = 1;
#[doc = "< Keypad or keyboard"]
pub const LV_INDEV_TYPE_KEYPAD: _bindgen_ty_16 = 2;
#[doc = "< External (hardware button) which is assigned to a specific point of the"]
#[doc = "screen"]
pub const LV_INDEV_TYPE_BUTTON: _bindgen_ty_16 = 3;
#[doc = "< Encoder with only Left, Right turn and a Button"]
pub const LV_INDEV_TYPE_ENCODER: _bindgen_ty_16 = 4;
#[doc = " Possible input device types"]
pub type _bindgen_ty_16 = u32;
pub const LV_INDEV_STATE_REL: _bindgen_ty_17 = 0;
pub const LV_INDEV_STATE_PR: _bindgen_ty_17 = 1;
#[doc = " States for input devices"]
pub type _bindgen_ty_17 = u32;
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Get the currently processed input device. Can be used in action functions too."]
#[doc = " Return: pointer to the currently processed input device or NULL if no input device processing"]
#[doc = " right now"]
pub fn lv_indev_get_act() -> *mut lv_indev_t;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Get the type of an input device"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " Return: the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`)"]
pub fn lv_indev_get_type(indev: *const lv_indev_t) -> lv_indev_type_t;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Reset one or all input devices"]
#[doc = " - __`indev`__: pointer to an input device to reset or NULL to reset all of them"]
#[doc = " - __`obj`__: pointer to an object which triggers the reset."]
pub fn lv_indev_reset(indev: *mut lv_indev_t, obj: *mut lv_obj_t);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Reset the long press state of an input device"]
#[doc = " - __`indev_proc`__: pointer to an input device"]
pub fn lv_indev_reset_long_press(indev: *mut lv_indev_t);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Enable or disable an input devices"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " - __`en`__: true: enable; false: disable"]
pub fn lv_indev_enable(indev: *mut lv_indev_t, en: bool);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " - __`cur_obj`__: pointer to an object to be used as cursor"]
pub fn lv_indev_set_cursor(indev: *mut lv_indev_t, cur_obj: *mut lv_obj_t);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Set the an array of points for LV_INDEV_TYPE_BUTTON."]
#[doc = " These points will be assigned to the buttons to press a specific point on the screen"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " - __`group`__: point to a group"]
pub fn lv_indev_set_button_points(indev: *mut lv_indev_t, points: *const lv_point_t);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " - __`point`__: pointer to a point to store the result"]
pub fn lv_indev_get_point(indev: *const lv_indev_t, point: *mut lv_point_t);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Get the current gesture direct"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " Return: current gesture direct"]
pub fn lv_indev_get_gesture_dir(indev: *const lv_indev_t) -> lv_gesture_dir_t;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " Return: the last pressed key (0 on error)"]
pub fn lv_indev_get_key(indev: *const lv_indev_t) -> u32;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Check if there is dragging with an input device or not (for LV_INDEV_TYPE_POINTER and"]
#[doc = " LV_INDEV_TYPE_BUTTON)"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " Return: true: drag is in progress"]
pub fn lv_indev_is_dragging(indev: *const lv_indev_t) -> bool;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Get the vector of dragging of an input device (for LV_INDEV_TYPE_POINTER and"]
#[doc = " LV_INDEV_TYPE_BUTTON)"]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " - __`point`__: pointer to a point to store the vector"]
pub fn lv_indev_get_vect(indev: *const lv_indev_t, point: *mut lv_point_t);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Manually finish dragging."]
#[doc = " `LV_SIGNAL_DRAG_END` and `LV_EVENT_DRAG_END` will be sent."]
#[doc = " - __`indev`__: pointer to an input device"]
#[doc = " Return: `LV_RES_INV` if the object being dragged was deleted. Else `LV_RES_OK`."]
pub fn lv_indev_finish_drag(indev: *mut lv_indev_t) -> lv_res_t;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Do nothing until the next release"]
#[doc = " - __`indev`__: pointer to an input device"]
pub fn lv_indev_wait_release(indev: *mut lv_indev_t);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Gets a pointer to the currently active object in indev proc functions."]
#[doc = " NULL if no object is currently being handled or if groups aren't used."]
#[doc = " Return: pointer to currently active object"]
pub fn lv_indev_get_obj_act() -> *mut lv_obj_t;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Search the most top, clickable object by a point"]
#[doc = " - __`obj`__: pointer to a start object, typically the screen"]
#[doc = " - __`point`__: pointer to a point for searching the most top child"]
#[doc = " Return: pointer to the found object or NULL if there was no suitable object"]
pub fn lv_indev_search_obj(obj: *mut lv_obj_t, point: *mut lv_point_t) -> *mut lv_obj_t;
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Get a pointer to the indev read task to"]
#[doc = " modify its parameters with `lv_task_...` functions."]
#[doc = " - __`indev`__: pointer to an inout device"]
#[doc = " Return: pointer to the indev read refresher task. (NULL on error)"]
pub fn lv_indev_get_read_task(indev: *mut lv_disp_t) -> *mut lv_task_t;
}