Skip to main content

m5unified_sys/
lib.rs

1#![allow(non_camel_case_types)]
2#![allow(non_snake_case)]
3#![allow(non_upper_case_globals)]
4#![allow(clippy::missing_safety_doc)]
5#![allow(clippy::too_many_arguments)]
6
7//! Raw bindings for a small C ABI shim over M5Unified.
8//!
9//! This crate intentionally does not bind M5Unified's C++ classes directly.
10//! Instead, `native/m5u_shim.cpp` exposes stable `extern "C"` functions that
11//! Rust can call from the higher-level `m5unified` crate. On non-ESP-IDF host
12//! targets these functions are stubbed so the safe wrapper and translated
13//! samples can be checked in CI without hardware.
14//!
15//! Firmware projects targeting ESP-IDF must provide the native shim component
16//! from this crate's `native/` directory in their ESP-IDF component graph. The
17//! host stubs are compile-time conveniences only and do not simulate M5Stack
18//! hardware behavior.
19
20use core::ffi::{c_char, c_float, c_int, c_void};
21
22pub type m5u_log_callback_t = Option<unsafe extern "C" fn(c_int, bool, *const c_char, *mut c_void)>;
23
24#[repr(C)]
25#[derive(Debug, Copy, Clone, PartialEq, Eq)]
26pub struct m5u_sd_spi_config_t {
27    pub pin_sclk: c_int,
28    pub pin_mosi: c_int,
29    pub pin_miso: c_int,
30    pub pin_cs: c_int,
31    pub host_id: c_int,
32    pub frequency_khz: u32,
33    pub max_files: c_int,
34    pub format_if_mount_failed: u8,
35}
36
37impl Default for m5u_sd_spi_config_t {
38    fn default() -> Self {
39        Self {
40            pin_sclk: -1,
41            pin_mosi: -1,
42            pin_miso: -1,
43            pin_cs: -1,
44            host_id: -1,
45            frequency_khz: 20_000,
46            max_files: 5,
47            format_if_mount_failed: 0,
48        }
49    }
50}
51
52#[repr(C)]
53#[derive(Debug, Copy, Clone, PartialEq, Eq)]
54pub struct m5u_config_t {
55    pub serial_baudrate: u32,
56    pub external_speaker_value: u8,
57    pub external_display_value: u16,
58    pub clear_display: u8,
59    pub output_power: u8,
60    pub pmic_button: u8,
61    pub internal_imu: u8,
62    pub internal_rtc: u8,
63    pub internal_mic: u8,
64    pub internal_spk: u8,
65    pub external_imu: u8,
66    pub external_rtc: u8,
67    pub disable_rtc_irq: u8,
68    pub led_brightness: u8,
69    pub fallback_board: c_int,
70}
71
72impl Default for m5u_config_t {
73    fn default() -> Self {
74        Self {
75            serial_baudrate: 0,
76            external_speaker_value: 0x00,
77            external_display_value: 0xFFFF,
78            clear_display: 1,
79            output_power: 1,
80            pmic_button: 1,
81            internal_imu: 1,
82            internal_rtc: 1,
83            internal_mic: 1,
84            internal_spk: 1,
85            external_imu: 0,
86            external_rtc: 0,
87            disable_rtc_irq: 1,
88            led_brightness: 0,
89            fallback_board: -1,
90        }
91    }
92}
93
94#[repr(C)]
95#[derive(Debug, Copy, Clone, PartialEq, Eq)]
96pub struct m5u_mic_config_t {
97    pub pin_data_in: c_int,
98    pub pin_bck: c_int,
99    pub pin_mck: c_int,
100    pub pin_ws: c_int,
101    pub sample_rate: u32,
102    pub left_channel: u8,
103    pub stereo: u8,
104    pub over_sampling: u8,
105    pub magnification: u8,
106    pub noise_filter_level: u8,
107    pub use_adc: u8,
108    pub dma_buf_len: usize,
109    pub dma_buf_count: usize,
110    pub task_priority: u8,
111    pub task_pinned_core: u8,
112    pub i2s_port: c_int,
113}
114
115impl Default for m5u_mic_config_t {
116    fn default() -> Self {
117        Self {
118            pin_data_in: -1,
119            pin_bck: -1,
120            pin_mck: -1,
121            pin_ws: -1,
122            sample_rate: 16_000,
123            left_channel: 0,
124            stereo: 0,
125            over_sampling: 2,
126            magnification: 16,
127            noise_filter_level: 0,
128            use_adc: 0,
129            dma_buf_len: 128,
130            dma_buf_count: 8,
131            task_priority: 2,
132            task_pinned_core: u8::MAX,
133            i2s_port: 0,
134        }
135    }
136}
137
138#[repr(C)]
139#[derive(Debug, Copy, Clone, PartialEq, Eq)]
140pub struct m5u_speaker_config_t {
141    pub pin_data_out: c_int,
142    pub pin_bck: c_int,
143    pub pin_mck: c_int,
144    pub pin_ws: c_int,
145    pub sample_rate: u32,
146    pub stereo: u8,
147    pub buzzer: u8,
148    pub use_dac: u8,
149    pub dac_zero_level: u8,
150    pub magnification: u8,
151    pub dma_buf_len: usize,
152    pub dma_buf_count: usize,
153    pub task_priority: u8,
154    pub task_pinned_core: u8,
155    pub i2s_port: c_int,
156}
157
158impl Default for m5u_speaker_config_t {
159    fn default() -> Self {
160        Self {
161            pin_data_out: -1,
162            pin_bck: -1,
163            pin_mck: -1,
164            pin_ws: -1,
165            sample_rate: 48_000,
166            stereo: 0,
167            buzzer: 0,
168            use_dac: 0,
169            dac_zero_level: 0,
170            magnification: 16,
171            dma_buf_len: 256,
172            dma_buf_count: 8,
173            task_priority: 2,
174            task_pinned_core: u8::MAX,
175            i2s_port: 0,
176        }
177    }
178}
179
180#[repr(C)]
181#[derive(Debug, Copy, Clone, PartialEq, Eq)]
182pub struct m5u_power_ext_port_bus_t {
183    pub voltage_mv: u16,
184    pub current_limit_ma: u8,
185    pub enable: bool,
186    pub direction_output: bool,
187}
188
189impl Default for m5u_power_ext_port_bus_t {
190    fn default() -> Self {
191        Self {
192            voltage_mv: 5_000,
193            current_limit_ma: 0,
194            enable: false,
195            direction_output: false,
196        }
197    }
198}
199
200#[repr(C)]
201#[derive(Debug, Copy, Clone, PartialEq)]
202pub struct m5u_power_ina226_config_t {
203    pub shunt_res: c_float,
204    pub max_expected_current: c_float,
205    pub sampling_rate: u8,
206    pub shunt_conversion_time: u8,
207    pub bus_conversion_time: u8,
208    pub mode: u8,
209}
210
211impl Default for m5u_power_ina226_config_t {
212    fn default() -> Self {
213        Self {
214            shunt_res: 0.1,
215            max_expected_current: 2.0,
216            sampling_rate: 0b010,
217            shunt_conversion_time: 0b100,
218            bus_conversion_time: 0b100,
219            mode: 0b111,
220        }
221    }
222}
223
224#[repr(C)]
225#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)]
226pub struct m5u_led_color_t {
227    pub r: u8,
228    pub g: u8,
229    pub b: u8,
230}
231
232#[repr(C)]
233#[derive(Debug, Copy, Clone, PartialEq, Eq)]
234pub struct m5u_led_strip_config_t {
235    pub led_count: usize,
236    pub color_order: c_int,
237    pub byte_per_led: u8,
238}
239
240impl Default for m5u_led_strip_config_t {
241    fn default() -> Self {
242        Self {
243            led_count: 1,
244            color_order: 2,
245            byte_per_led: 3,
246        }
247    }
248}
249
250#[repr(C)]
251#[derive(Debug, Copy, Clone, PartialEq, Eq)]
252pub struct m5u_led_strip_rmt_config_t {
253    pub frequency: u32,
254    pub t0h_ns: u16,
255    pub t0l_ns: u16,
256    pub t1h_ns: u16,
257    pub t1l_ns: u16,
258    pub reset_us: u16,
259    pub pin_data: i8,
260}
261
262impl Default for m5u_led_strip_rmt_config_t {
263    fn default() -> Self {
264        Self {
265            frequency: 10_000_000,
266            t0h_ns: 300,
267            t0l_ns: 900,
268            t1h_ns: 900,
269            t1l_ns: 300,
270            reset_us: 280,
271            pin_data: -1,
272        }
273    }
274}
275
276#[repr(C)]
277#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)]
278pub struct m5u_touch_detail_t {
279    pub x: c_int,
280    pub y: c_int,
281    pub prev_x: c_int,
282    pub prev_y: c_int,
283    pub base_x: c_int,
284    pub base_y: c_int,
285    pub base_msec: u32,
286    pub state: u8,
287    pub is_pressed: bool,
288    pub was_pressed: bool,
289    pub was_released: bool,
290    pub was_clicked: bool,
291    pub was_hold: bool,
292    pub is_holding: bool,
293    pub click_count: c_int,
294}
295
296#[repr(C)]
297#[derive(Debug, Copy, Clone, PartialEq, Eq)]
298pub struct m5u_rtc_datetime_t {
299    pub year: c_int,
300    pub month: c_int,
301    pub day: c_int,
302    pub weekday: c_int,
303    pub hour: c_int,
304    pub minute: c_int,
305    pub second: c_int,
306}
307
308impl Default for m5u_rtc_datetime_t {
309    fn default() -> Self {
310        Self {
311            year: 2026,
312            month: 1,
313            day: 1,
314            weekday: 4,
315            hour: 0,
316            minute: 0,
317            second: 0,
318        }
319    }
320}
321
322#[repr(C)]
323#[derive(Debug, Copy, Clone, Default, PartialEq)]
324pub struct m5u_imu_data_t {
325    pub usec: u32,
326    pub accel_x: f32,
327    pub accel_y: f32,
328    pub accel_z: f32,
329    pub gyro_x: f32,
330    pub gyro_y: f32,
331    pub gyro_z: f32,
332    pub mag_x: f32,
333    pub mag_y: f32,
334    pub mag_z: f32,
335}
336
337#[repr(C)]
338#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)]
339pub struct m5u_imu_raw_data_t {
340    pub accel_x: i16,
341    pub accel_y: i16,
342    pub accel_z: i16,
343    pub gyro_x: i16,
344    pub gyro_y: i16,
345    pub gyro_z: i16,
346    pub mag_x: i16,
347    pub mag_y: i16,
348    pub mag_z: i16,
349    pub temp: i16,
350    pub sensor_mask: u8,
351}
352
353#[repr(C)]
354#[derive(Debug, Copy, Clone, PartialEq)]
355pub struct m5u_imu_convert_param_t {
356    pub accel_res: f32,
357    pub gyro_res: f32,
358    pub mag_res: f32,
359    pub temp_res: f32,
360    pub temp_offset: f32,
361}
362
363impl Default for m5u_imu_convert_param_t {
364    fn default() -> Self {
365        Self {
366            accel_res: 8.0 / 32768.0,
367            gyro_res: 2000.0 / 32768.0,
368            mag_res: 10.0 * 4912.0 / 32768.0,
369            temp_res: 1.0,
370            temp_offset: 0.0,
371        }
372    }
373}
374
375#[cfg(target_os = "espidf")]
376extern "C" {
377    pub fn m5u_begin() -> bool;
378    pub fn m5u_begin_with_config(config: *const m5u_config_t) -> bool;
379    pub fn m5u_update();
380    pub fn m5u_delay_ms(ms: u32);
381    pub fn m5u_millis() -> u32;
382    pub fn m5u_micros() -> u32;
383    pub fn m5u_get_update_msec() -> u32;
384    pub fn m5u_get_board() -> c_int;
385    pub fn m5u_get_pin(name: c_int) -> c_int;
386    pub fn m5u_set_primary_display_index(index: usize) -> bool;
387    pub fn m5u_set_primary_display_type(kind: c_int) -> bool;
388    pub fn m5u_set_primary_display_types(kinds: *const c_int, len: usize) -> bool;
389    pub fn m5u_set_log_display_index(index: usize);
390    pub fn m5u_set_log_display_type(kind: c_int);
391    pub fn m5u_set_log_display_types(kinds: *const c_int, len: usize);
392    pub fn m5u_set_touch_button_height(pixel: u16);
393    pub fn m5u_set_touch_button_height_by_ratio(ratio: u8);
394    pub fn m5u_get_touch_button_height() -> u16;
395
396    pub fn m5u_io_expander_available(index: usize) -> bool;
397    pub fn m5u_io_expander_set_direction(index: usize, pin: u8, output: bool) -> bool;
398    pub fn m5u_io_expander_enable_pull(index: usize, pin: u8, enable: bool) -> bool;
399    pub fn m5u_io_expander_set_pull_mode(index: usize, pin: u8, pull_up: bool) -> bool;
400    pub fn m5u_io_expander_set_high_impedance(index: usize, pin: u8, enable: bool) -> bool;
401    pub fn m5u_io_expander_get_write_value(index: usize, pin: u8) -> bool;
402    pub fn m5u_io_expander_digital_write(index: usize, pin: u8, level: bool) -> bool;
403    pub fn m5u_io_expander_digital_read(index: usize, pin: u8) -> bool;
404    pub fn m5u_io_expander_reset_irq(index: usize) -> bool;
405    pub fn m5u_io_expander_disable_irq(index: usize) -> bool;
406    pub fn m5u_io_expander_enable_irq(index: usize) -> bool;
407    pub fn m5u_pi4ioe5v6408_begin() -> bool;
408    pub fn m5u_pi4ioe5v6408_set_direction(pin: u8, output: bool) -> bool;
409    pub fn m5u_pi4ioe5v6408_enable_pull(pin: u8, enable: bool) -> bool;
410    pub fn m5u_pi4ioe5v6408_set_pull_mode(pin: u8, pull_up: bool) -> bool;
411    pub fn m5u_pi4ioe5v6408_set_high_impedance(pin: u8, enable: bool) -> bool;
412    pub fn m5u_pi4ioe5v6408_get_write_value(pin: u8) -> bool;
413    pub fn m5u_pi4ioe5v6408_digital_write(pin: u8, level: bool) -> bool;
414    pub fn m5u_pi4ioe5v6408_digital_read(pin: u8) -> bool;
415    pub fn m5u_pi4ioe5v6408_reset_irq();
416    pub fn m5u_pi4ioe5v6408_disable_irq();
417    pub fn m5u_pi4ioe5v6408_enable_irq();
418
419    pub fn m5u_i2c_set_port(bus: c_int, port_num: c_int, pin_sda: c_int, pin_scl: c_int);
420    pub fn m5u_i2c_begin(bus: c_int) -> bool;
421    pub fn m5u_i2c_begin_with_port(
422        bus: c_int,
423        port_num: c_int,
424        pin_sda: c_int,
425        pin_scl: c_int,
426    ) -> bool;
427    pub fn m5u_i2c_release(bus: c_int) -> bool;
428    pub fn m5u_i2c_is_enabled(bus: c_int) -> bool;
429    pub fn m5u_i2c_get_port(bus: c_int) -> c_int;
430    pub fn m5u_i2c_get_sda(bus: c_int) -> c_int;
431    pub fn m5u_i2c_get_scl(bus: c_int) -> c_int;
432    pub fn m5u_i2c_start(bus: c_int, address: u8, read: bool, freq: u32) -> bool;
433    pub fn m5u_i2c_restart(bus: c_int, address: u8, read: bool, freq: u32) -> bool;
434    pub fn m5u_i2c_stop(bus: c_int) -> bool;
435    pub fn m5u_i2c_write_byte(bus: c_int, data: u8) -> bool;
436    pub fn m5u_i2c_write(bus: c_int, data: *const u8, length: usize) -> bool;
437    pub fn m5u_i2c_read(bus: c_int, result: *mut u8, length: usize, last_nack: bool) -> bool;
438    pub fn m5u_i2c_write_register(
439        bus: c_int,
440        address: u8,
441        reg: u8,
442        data: *const u8,
443        length: usize,
444        freq: u32,
445    ) -> bool;
446    pub fn m5u_i2c_read_register(
447        bus: c_int,
448        address: u8,
449        reg: u8,
450        result: *mut u8,
451        length: usize,
452        freq: u32,
453    ) -> bool;
454    pub fn m5u_i2c_write_register8(bus: c_int, address: u8, reg: u8, data: u8, freq: u32) -> bool;
455    pub fn m5u_i2c_read_register8(bus: c_int, address: u8, reg: u8, freq: u32) -> u8;
456    pub fn m5u_i2c_bit_on(bus: c_int, address: u8, reg: u8, data: u8, freq: u32) -> bool;
457    pub fn m5u_i2c_bit_off(bus: c_int, address: u8, reg: u8, data: u8, freq: u32) -> bool;
458    pub fn m5u_i2c_scan(bus: c_int, result: *mut bool, freq: u32);
459    pub fn m5u_i2c_scan_address(bus: c_int, address: u8, freq: u32) -> bool;
460
461    pub fn m5u_display_width() -> c_int;
462    pub fn m5u_display_height() -> c_int;
463    pub fn m5u_display_fill_screen(color: u16);
464    pub fn m5u_display_set_cursor(x: c_int, y: c_int);
465    pub fn m5u_display_set_text_size(size: c_int);
466    pub fn m5u_display_set_text_color(fg: u16, bg: u16);
467    pub fn m5u_display_print(text: *const c_char);
468    pub fn m5u_display_println(text: *const c_char);
469    pub fn m5u_display_draw_line(x0: c_int, y0: c_int, x1: c_int, y1: c_int, color: u16);
470    pub fn m5u_display_draw_rect(x: c_int, y: c_int, w: c_int, h: c_int, color: u16);
471    pub fn m5u_display_fill_rect(x: c_int, y: c_int, w: c_int, h: c_int, color: u16);
472    pub fn m5u_display_draw_circle(x: c_int, y: c_int, r: c_int, color: u16);
473    pub fn m5u_display_fill_circle(x: c_int, y: c_int, r: c_int, color: u16);
474    pub fn m5u_display_set_rotation(rotation: c_int);
475
476    pub fn m5u_btn_a_is_pressed() -> bool;
477    pub fn m5u_btn_a_was_pressed() -> bool;
478    pub fn m5u_btn_a_was_released() -> bool;
479    pub fn m5u_btn_b_is_pressed() -> bool;
480    pub fn m5u_btn_b_was_pressed() -> bool;
481    pub fn m5u_btn_b_was_released() -> bool;
482    pub fn m5u_btn_c_is_pressed() -> bool;
483    pub fn m5u_btn_c_was_pressed() -> bool;
484    pub fn m5u_btn_c_was_released() -> bool;
485
486    pub fn m5u_mic_begin() -> bool;
487    pub fn m5u_mic_record_i16(buffer: *mut i16, samples: usize) -> bool;
488    pub fn m5u_mic_record_u8(buffer: *mut u8, samples: usize) -> bool;
489    pub fn m5u_speaker_begin() -> bool;
490    pub fn m5u_speaker_set_volume(volume: u8);
491    pub fn m5u_speaker_tone(frequency_hz: u32, duration_ms: u32) -> bool;
492    pub fn m5u_speaker_play_i16(samples: *const i16, len: usize, sample_rate_hz: u32) -> bool;
493
494    pub fn m5u_imu_begin() -> bool;
495    pub fn m5u_imu_begin_for_board(board: c_int) -> bool;
496    pub fn m5u_imu_get_accel(x: *mut f32, y: *mut f32, z: *mut f32) -> bool;
497    pub fn m5u_imu_get_gyro(x: *mut f32, y: *mut f32, z: *mut f32) -> bool;
498    pub fn m5u_imu_get_mag(x: *mut f32, y: *mut f32, z: *mut f32) -> bool;
499    pub fn m5u_imu_get_data(out: *mut m5u_imu_data_t) -> bool;
500    pub fn m5u_imu_get_temp_c(temp: *mut f32) -> bool;
501
502    pub fn m5u_touch_count() -> c_int;
503    pub fn m5u_touch_get(index: c_int, x: *mut c_int, y: *mut c_int) -> bool;
504    pub fn m5u_touch_get_raw(index: c_int, x: *mut c_int, y: *mut c_int) -> bool;
505
506    pub fn m5u_rtc_begin() -> bool;
507    pub fn m5u_rtc_begin_for_board(board: c_int) -> bool;
508    pub fn m5u_rtc_is_enabled() -> bool;
509    pub fn m5u_rtc_get_volt_low() -> bool;
510    pub fn m5u_rtc_get_datetime(
511        year: *mut c_int,
512        month: *mut c_int,
513        day: *mut c_int,
514        hour: *mut c_int,
515        minute: *mut c_int,
516        second: *mut c_int,
517    ) -> bool;
518    pub fn m5u_rtc_get_datetime_detail(out: *mut m5u_rtc_datetime_t) -> bool;
519    pub fn m5u_rtc_get_date_detail(out: *mut m5u_rtc_datetime_t) -> bool;
520    pub fn m5u_rtc_get_time_detail(out: *mut m5u_rtc_datetime_t) -> bool;
521    pub fn m5u_rtc_set_datetime(
522        year: c_int,
523        month: c_int,
524        day: c_int,
525        hour: c_int,
526        minute: c_int,
527        second: c_int,
528    ) -> bool;
529    pub fn m5u_rtc_set_datetime_detail(datetime: *const m5u_rtc_datetime_t) -> bool;
530    pub fn m5u_rtc_set_date_detail(date: *const m5u_rtc_datetime_t) -> bool;
531    pub fn m5u_rtc_set_time_detail(time: *const m5u_rtc_datetime_t) -> bool;
532    pub fn m5u_rtc_device_begin(kind: c_int) -> bool;
533    pub fn m5u_rtc_device_get_datetime_detail(kind: c_int, out: *mut m5u_rtc_datetime_t) -> bool;
534    pub fn m5u_rtc_device_get_date_detail(kind: c_int, out: *mut m5u_rtc_datetime_t) -> bool;
535    pub fn m5u_rtc_device_get_time_detail(kind: c_int, out: *mut m5u_rtc_datetime_t) -> bool;
536    pub fn m5u_rtc_device_set_datetime_detail(
537        kind: c_int,
538        datetime: *const m5u_rtc_datetime_t,
539    ) -> bool;
540    pub fn m5u_rtc_device_set_date_detail(kind: c_int, date: *const m5u_rtc_datetime_t) -> bool;
541    pub fn m5u_rtc_device_set_time_detail(kind: c_int, time: *const m5u_rtc_datetime_t) -> bool;
542    pub fn m5u_rtc_device_get_volt_low(kind: c_int) -> bool;
543    pub fn m5u_rtc_device_set_timer_irq(kind: c_int, timer_msec: u32) -> u32;
544    pub fn m5u_rtc_device_set_alarm_irq_datetime(
545        kind: c_int,
546        datetime: *const m5u_rtc_datetime_t,
547    ) -> c_int;
548    pub fn m5u_rtc_device_set_alarm_irq_time(kind: c_int, time: *const m5u_rtc_datetime_t)
549        -> c_int;
550    pub fn m5u_rtc_device_get_irq_status(kind: c_int) -> bool;
551    pub fn m5u_rtc_device_clear_irq(kind: c_int);
552    pub fn m5u_rtc_device_disable_irq(kind: c_int);
553
554    pub fn m5u_battery_level() -> c_int;
555    pub fn m5u_battery_voltage_mv() -> c_int;
556    pub fn m5u_power_begin() -> bool;
557    pub fn m5u_power_get_type() -> c_int;
558    pub fn m5u_power_get_charge_state() -> c_int;
559    pub fn m5u_power_is_charging() -> bool;
560    pub fn m5u_power_set_led(brightness: u8);
561    pub fn m5u_power_set_ext_output(enable: bool, port_mask: u16);
562    pub fn m5u_power_get_ext_output() -> bool;
563    pub fn m5u_power_set_usb_output(enable: bool);
564    pub fn m5u_power_get_usb_output() -> bool;
565    pub fn m5u_power_set_battery_charge(enable: bool);
566    pub fn m5u_power_set_charge_current(max_ma: u16);
567    pub fn m5u_power_set_charge_voltage(max_mv: u16);
568    pub fn m5u_power_get_vbus_voltage_mv() -> c_int;
569    pub fn m5u_power_get_battery_current_ma() -> c_int;
570    pub fn m5u_power_get_ext_voltage_mv(port_mask: u16) -> c_float;
571    pub fn m5u_power_get_ext_current_ma(port_mask: u16) -> c_float;
572    pub fn m5u_power_get_key_state() -> u8;
573    pub fn m5u_power_set_ext_port_bus_config(config: *const m5u_power_ext_port_bus_t);
574    pub fn m5u_power_set_vibration(level: u8);
575    pub fn m5u_power_power_off();
576    pub fn m5u_power_timer_sleep_seconds(seconds: c_int);
577    pub fn m5u_power_timer_sleep_time(time: *const m5u_rtc_datetime_t);
578    pub fn m5u_power_timer_sleep_date_time(
579        date: *const m5u_rtc_datetime_t,
580        time: *const m5u_rtc_datetime_t,
581    );
582    pub fn m5u_power_deep_sleep_us(micro_seconds: u64, touch_wakeup: bool);
583    pub fn m5u_power_light_sleep_us(micro_seconds: u64, touch_wakeup: bool);
584
585    pub fn m5u_display_get_rotation() -> c_int;
586    pub fn m5u_display_set_brightness(brightness: u8);
587    pub fn m5u_display_set_epd_fastest();
588    pub fn m5u_display_set_epd_mode(mode: c_int);
589    pub fn m5u_display_set_text_scroll(scroll: bool);
590    pub fn m5u_display_set_font(font: c_int) -> bool;
591    pub fn m5u_display_start_write();
592    pub fn m5u_display_end_write();
593    pub fn m5u_display_display();
594    pub fn m5u_display_display_busy() -> bool;
595    pub fn m5u_display_wait_display();
596    pub fn m5u_display_get_cursor_y() -> c_int;
597    pub fn m5u_display_font_height() -> c_int;
598    pub fn m5u_display_get_base_color() -> u16;
599    pub fn m5u_display_set_color(color: u16);
600    pub fn m5u_display_set_text_wrap(wrap_x: bool, wrap_y: bool);
601    pub fn m5u_display_set_text_datum(datum: c_int);
602    pub fn m5u_display_draw_string(text: *const c_char, x: c_int, y: c_int) -> c_int;
603    pub fn m5u_display_draw_pixel(x: c_int, y: c_int, color: u16);
604    pub fn m5u_display_write_pixel(x: c_int, y: c_int, color: u16);
605    pub fn m5u_display_draw_fast_hline(x: c_int, y: c_int, w: c_int, color: u16);
606    pub fn m5u_display_write_fast_hline(x: c_int, y: c_int, w: c_int, color: u16);
607    pub fn m5u_display_draw_fast_vline(x: c_int, y: c_int, h: c_int, color: u16);
608    pub fn m5u_display_write_fast_vline(x: c_int, y: c_int, h: c_int, color: u16);
609    pub fn m5u_display_draw_round_rect(
610        x: c_int,
611        y: c_int,
612        w: c_int,
613        h: c_int,
614        r: c_int,
615        color: u16,
616    );
617    pub fn m5u_display_fill_round_rect(
618        x: c_int,
619        y: c_int,
620        w: c_int,
621        h: c_int,
622        r: c_int,
623        color: u16,
624    );
625    pub fn m5u_display_draw_triangle(
626        x0: c_int,
627        y0: c_int,
628        x1: c_int,
629        y1: c_int,
630        x2: c_int,
631        y2: c_int,
632        color: u16,
633    );
634    pub fn m5u_display_fill_triangle(
635        x0: c_int,
636        y0: c_int,
637        x1: c_int,
638        y1: c_int,
639        x2: c_int,
640        y2: c_int,
641        color: u16,
642    );
643    pub fn m5u_display_draw_ellipse(x: c_int, y: c_int, rx: c_int, ry: c_int, color: u16);
644    pub fn m5u_display_fill_ellipse(x: c_int, y: c_int, rx: c_int, ry: c_int, color: u16);
645    pub fn m5u_display_draw_arc(
646        x: c_int,
647        y: c_int,
648        r0: c_int,
649        r1: c_int,
650        angle0: c_float,
651        angle1: c_float,
652        color: u16,
653    );
654    pub fn m5u_display_fill_arc(
655        x: c_int,
656        y: c_int,
657        r0: c_int,
658        r1: c_int,
659        angle0: c_float,
660        angle1: c_float,
661        color: u16,
662    );
663    pub fn m5u_display_set_scroll_rect(x: c_int, y: c_int, w: c_int, h: c_int);
664    pub fn m5u_display_set_scroll_rect_color(x: c_int, y: c_int, w: c_int, h: c_int, color: u16);
665    pub fn m5u_display_scroll(dx: c_int, dy: c_int);
666    pub fn m5u_display_text_width(text: *const c_char) -> c_int;
667    pub fn m5u_display_get_text_datum() -> c_int;
668    pub fn m5u_display_set_text_padding(padding: u32);
669    pub fn m5u_display_get_text_padding() -> u32;
670    pub fn m5u_display_get_text_size_x() -> c_float;
671    pub fn m5u_display_get_text_size_y() -> c_float;
672    pub fn m5u_display_set_clip_rect(x: c_int, y: c_int, w: c_int, h: c_int);
673    pub fn m5u_display_clear_clip_rect();
674    pub fn m5u_display_color888(r: u8, g: u8, b: u8) -> u16;
675    pub fn m5u_display_count() -> c_int;
676    pub fn m5u_display_index_for_kind(kind: c_int) -> c_int;
677    pub fn m5u_display_index_for_kinds(kinds: *const c_int, len: usize) -> c_int;
678    pub fn m5u_display_width_at(index: c_int) -> c_int;
679    pub fn m5u_display_height_at(index: c_int) -> c_int;
680    pub fn m5u_display_fill_screen_at(index: c_int, color: u16);
681    pub fn m5u_display_set_cursor_at(index: c_int, x: c_int, y: c_int);
682    pub fn m5u_display_set_text_size_at(index: c_int, size: c_int);
683    pub fn m5u_display_set_text_color_at(index: c_int, fg: u16, bg: u16);
684    pub fn m5u_display_get_rotation_at(index: c_int) -> c_int;
685    pub fn m5u_display_set_rotation_at(index: c_int, rotation: c_int);
686    pub fn m5u_display_set_color_at(index: c_int, color: u16);
687    pub fn m5u_display_start_write_at(index: c_int);
688    pub fn m5u_display_end_write_at(index: c_int);
689    pub fn m5u_display_print_at(index: c_int, text: *const c_char);
690    pub fn m5u_display_println_at(index: c_int, text: *const c_char);
691    pub fn m5u_display_draw_string_at(
692        index: c_int,
693        text: *const c_char,
694        x: c_int,
695        y: c_int,
696    ) -> c_int;
697    pub fn m5u_display_draw_line_at(
698        index: c_int,
699        x0: c_int,
700        y0: c_int,
701        x1: c_int,
702        y1: c_int,
703        color: u16,
704    );
705    pub fn m5u_display_draw_rect_at(
706        index: c_int,
707        x: c_int,
708        y: c_int,
709        w: c_int,
710        h: c_int,
711        color: u16,
712    );
713    pub fn m5u_display_fill_rect_at(
714        index: c_int,
715        x: c_int,
716        y: c_int,
717        w: c_int,
718        h: c_int,
719        color: u16,
720    );
721    pub fn m5u_display_draw_circle_at(index: c_int, x: c_int, y: c_int, r: c_int, color: u16);
722    pub fn m5u_display_fill_circle_at(index: c_int, x: c_int, y: c_int, r: c_int, color: u16);
723    pub fn m5u_display_write_pixel_at(index: c_int, x: c_int, y: c_int, color: u16);
724    pub fn m5u_display_draw_pixel_at(index: c_int, x: c_int, y: c_int, color: u16);
725    pub fn m5u_display_draw_fast_hline_at(index: c_int, x: c_int, y: c_int, w: c_int, color: u16);
726    pub fn m5u_display_write_fast_hline_at(index: c_int, x: c_int, y: c_int, w: c_int, color: u16);
727    pub fn m5u_display_draw_fast_vline_at(index: c_int, x: c_int, y: c_int, h: c_int, color: u16);
728    pub fn m5u_display_write_fast_vline_at(index: c_int, x: c_int, y: c_int, h: c_int, color: u16);
729    pub fn m5u_display_draw_round_rect_at(
730        index: c_int,
731        x: c_int,
732        y: c_int,
733        w: c_int,
734        h: c_int,
735        r: c_int,
736        color: u16,
737    );
738    pub fn m5u_display_fill_round_rect_at(
739        index: c_int,
740        x: c_int,
741        y: c_int,
742        w: c_int,
743        h: c_int,
744        r: c_int,
745        color: u16,
746    );
747    pub fn m5u_display_draw_triangle_at(
748        index: c_int,
749        x0: c_int,
750        y0: c_int,
751        x1: c_int,
752        y1: c_int,
753        x2: c_int,
754        y2: c_int,
755        color: u16,
756    );
757    pub fn m5u_display_fill_triangle_at(
758        index: c_int,
759        x0: c_int,
760        y0: c_int,
761        x1: c_int,
762        y1: c_int,
763        x2: c_int,
764        y2: c_int,
765        color: u16,
766    );
767    pub fn m5u_display_draw_ellipse_at(
768        index: c_int,
769        x: c_int,
770        y: c_int,
771        rx: c_int,
772        ry: c_int,
773        color: u16,
774    );
775    pub fn m5u_display_fill_ellipse_at(
776        index: c_int,
777        x: c_int,
778        y: c_int,
779        rx: c_int,
780        ry: c_int,
781        color: u16,
782    );
783    pub fn m5u_display_draw_arc_at(
784        index: c_int,
785        x: c_int,
786        y: c_int,
787        r0: c_int,
788        r1: c_int,
789        angle0: c_float,
790        angle1: c_float,
791        color: u16,
792    );
793    pub fn m5u_display_fill_arc_at(
794        index: c_int,
795        x: c_int,
796        y: c_int,
797        r0: c_int,
798        r1: c_int,
799        angle0: c_float,
800        angle1: c_float,
801        color: u16,
802    );
803    pub fn m5u_display_set_scroll_rect_at(index: c_int, x: c_int, y: c_int, w: c_int, h: c_int);
804    pub fn m5u_display_set_scroll_rect_color_at(
805        index: c_int,
806        x: c_int,
807        y: c_int,
808        w: c_int,
809        h: c_int,
810        color: u16,
811    );
812    pub fn m5u_display_scroll_at(index: c_int, dx: c_int, dy: c_int);
813    pub fn m5u_display_text_width_at(index: c_int, text: *const c_char) -> c_int;
814    pub fn m5u_display_get_text_datum_at(index: c_int) -> c_int;
815    pub fn m5u_display_set_text_padding_at(index: c_int, padding: u32);
816    pub fn m5u_display_get_text_padding_at(index: c_int) -> u32;
817    pub fn m5u_display_get_text_size_x_at(index: c_int) -> c_float;
818    pub fn m5u_display_get_text_size_y_at(index: c_int) -> c_float;
819
820    pub fn m5u_button_is_pressed(button: c_int) -> bool;
821    pub fn m5u_button_was_pressed(button: c_int) -> bool;
822    pub fn m5u_button_was_released(button: c_int) -> bool;
823    pub fn m5u_button_was_clicked(button: c_int) -> bool;
824    pub fn m5u_button_was_hold(button: c_int) -> bool;
825    pub fn m5u_button_is_holding(button: c_int) -> bool;
826    pub fn m5u_button_was_decide_click_count(button: c_int) -> bool;
827    pub fn m5u_button_get_click_count(button: c_int) -> c_int;
828    pub fn m5u_button_was_single_clicked(button: c_int) -> bool;
829    pub fn m5u_button_was_double_clicked(button: c_int) -> bool;
830    pub fn m5u_button_was_change_pressed(button: c_int) -> bool;
831    pub fn m5u_button_is_released(button: c_int) -> bool;
832    pub fn m5u_button_was_released_after_hold(button: c_int) -> bool;
833    pub fn m5u_button_was_release_for(button: c_int, ms: u32) -> bool;
834    pub fn m5u_button_pressed_for(button: c_int, ms: u32) -> bool;
835    pub fn m5u_button_released_for(button: c_int, ms: u32) -> bool;
836    pub fn m5u_button_set_debounce_thresh(button: c_int, ms: u32);
837    pub fn m5u_button_set_hold_thresh(button: c_int, ms: u32);
838    pub fn m5u_button_set_raw_state(button: c_int, msec: u32, press: bool);
839    pub fn m5u_button_set_state(button: c_int, msec: u32, state: u8);
840    pub fn m5u_button_get_state(button: c_int) -> u8;
841    pub fn m5u_button_last_change(button: c_int) -> u32;
842    pub fn m5u_button_get_debounce_thresh(button: c_int) -> u32;
843    pub fn m5u_button_get_hold_thresh(button: c_int) -> u32;
844    pub fn m5u_button_get_update_msec(button: c_int) -> u32;
845
846    pub fn m5u_mic_is_enabled() -> bool;
847    pub fn m5u_mic_is_running() -> bool;
848    pub fn m5u_mic_is_recording() -> bool;
849    pub fn m5u_mic_recording_state() -> usize;
850    pub fn m5u_mic_end();
851    pub fn m5u_mic_record_i16_at(buffer: *mut i16, samples: usize, sample_rate_hz: u32) -> bool;
852    pub fn m5u_mic_record_i16_ex(
853        buffer: *mut i16,
854        samples: usize,
855        sample_rate_hz: u32,
856        stereo: bool,
857    ) -> bool;
858    pub fn m5u_mic_record_u8_ex(
859        buffer: *mut u8,
860        samples: usize,
861        sample_rate_hz: u32,
862        stereo: bool,
863    ) -> bool;
864    pub fn m5u_mic_set_sample_rate(sample_rate_hz: u32);
865    pub fn m5u_mic_get_config(out: *mut m5u_mic_config_t) -> bool;
866    pub fn m5u_mic_set_config(config: *const m5u_mic_config_t) -> bool;
867    pub fn m5u_mic_get_noise_filter_level() -> c_int;
868    pub fn m5u_mic_set_noise_filter_level(level: c_int) -> bool;
869
870    pub fn m5u_speaker_is_enabled() -> bool;
871    pub fn m5u_speaker_is_running() -> bool;
872    pub fn m5u_speaker_end();
873    pub fn m5u_speaker_get_volume() -> u8;
874    pub fn m5u_speaker_get_config(out: *mut m5u_speaker_config_t) -> bool;
875    pub fn m5u_speaker_set_config(config: *const m5u_speaker_config_t) -> bool;
876    pub fn m5u_speaker_tone_ex(frequency_hz: c_float, duration_ms: u32, channel: c_int) -> bool;
877    pub fn m5u_speaker_tone_options(
878        frequency_hz: c_float,
879        duration_ms: u32,
880        channel: c_int,
881        stop_current_sound: bool,
882    ) -> bool;
883    pub fn m5u_speaker_tone_full(
884        frequency_hz: c_float,
885        duration_ms: u32,
886        channel: c_int,
887        stop_current_sound: bool,
888        raw_data: *const u8,
889        len: usize,
890        stereo: bool,
891    ) -> bool;
892    pub fn m5u_speaker_play_u8(samples: *const u8, len: usize, sample_rate_hz: u32) -> bool;
893    pub fn m5u_speaker_play_u8_ex(
894        samples: *const u8,
895        len: usize,
896        sample_rate_hz: u32,
897        stereo: bool,
898        repeat: u32,
899        channel: c_int,
900        stop_current_sound: bool,
901    ) -> bool;
902    pub fn m5u_speaker_play_i8_ex(
903        samples: *const i8,
904        len: usize,
905        sample_rate_hz: u32,
906        stereo: bool,
907        repeat: u32,
908        channel: c_int,
909        stop_current_sound: bool,
910    ) -> bool;
911    pub fn m5u_speaker_play_i16_ex(
912        samples: *const i16,
913        len: usize,
914        sample_rate_hz: u32,
915        stereo: bool,
916        repeat: u32,
917        channel: c_int,
918        stop_current_sound: bool,
919    ) -> bool;
920    pub fn m5u_speaker_play_wav(data: *const u8, len: usize) -> bool;
921    pub fn m5u_speaker_play_wav_ex(
922        data: *const u8,
923        len: usize,
924        repeat: u32,
925        channel: c_int,
926        stop_current_sound: bool,
927    ) -> bool;
928    pub fn m5u_speaker_is_playing(channel: c_int) -> bool;
929    pub fn m5u_speaker_playing_channels() -> usize;
930    pub fn m5u_speaker_channel_playing_state(channel: c_int) -> usize;
931    pub fn m5u_speaker_stop(channel: c_int);
932    pub fn m5u_speaker_get_channel_volume(channel: c_int) -> u8;
933    pub fn m5u_speaker_set_channel_volume(channel: c_int, volume: u8);
934    pub fn m5u_speaker_set_all_channel_volume(volume: u8);
935
936    pub fn m5u_imu_is_enabled() -> bool;
937    pub fn m5u_imu_get_type() -> c_int;
938    pub fn m5u_imu_update() -> bool;
939    pub fn m5u_imu_update_mask() -> c_int;
940    pub fn m5u_imu_sleep() -> bool;
941    pub fn m5u_imu_set_clock(freq: u32);
942    pub fn m5u_imu_set_axis_order(axis0: c_int, axis1: c_int, axis2: c_int) -> bool;
943    pub fn m5u_imu_set_axis_order_right_handed(axis0: c_int, axis1: c_int) -> bool;
944    pub fn m5u_imu_set_axis_order_left_handed(axis0: c_int, axis1: c_int) -> bool;
945    pub fn m5u_imu_set_int_pin_active_logic(level: bool) -> bool;
946    pub fn m5u_imu_load_offset_from_nvs() -> bool;
947    pub fn m5u_imu_save_offset_to_nvs() -> bool;
948    pub fn m5u_imu_get_offset_data(index: c_int) -> c_float;
949    pub fn m5u_imu_set_calibration(x: c_float, y: c_float, z: c_float);
950    pub fn m5u_imu_set_calibration_strength(accel: u8, gyro: u8, mag: u8);
951    pub fn m5u_imu_clear_offset_data();
952    pub fn m5u_imu_set_offset_data(index: usize, value: i32);
953    pub fn m5u_imu_get_offset_data_i32(index: usize) -> i32;
954    pub fn m5u_imu_get_raw_data(index: usize) -> i16;
955    pub fn m5u_imu_device_begin(kind: c_int) -> c_int;
956    pub fn m5u_imu_device_get_raw_data(kind: c_int, out: *mut m5u_imu_raw_data_t) -> bool;
957    pub fn m5u_imu_device_get_convert_param(kind: c_int, out: *mut m5u_imu_convert_param_t)
958        -> bool;
959    pub fn m5u_imu_device_get_temp_adc(kind: c_int, adc: *mut i16) -> bool;
960    pub fn m5u_imu_device_sleep(kind: c_int) -> bool;
961    pub fn m5u_imu_device_set_int_pin_active_logic(kind: c_int, level: bool) -> bool;
962    pub fn m5u_imu_device_who_am_i(kind: c_int) -> c_int;
963
964    pub fn m5u_touch_get_detail(index: c_int, out: *mut m5u_touch_detail_t) -> bool;
965    pub fn m5u_touch_is_enabled() -> bool;
966    pub fn m5u_touch_set_hold_thresh(ms: u16);
967    pub fn m5u_touch_set_flick_thresh(distance: u16);
968    pub fn m5u_rtc_set_system_time_from_rtc();
969    pub fn m5u_rtc_set_timer_irq(timer_msec: u32) -> u32;
970    pub fn m5u_rtc_set_alarm_irq_after_seconds(after_seconds: c_int) -> c_int;
971    pub fn m5u_rtc_set_alarm_irq_datetime(datetime: *const m5u_rtc_datetime_t) -> c_int;
972    pub fn m5u_rtc_set_alarm_irq_time(time: *const m5u_rtc_datetime_t) -> c_int;
973    pub fn m5u_rtc_get_irq_status() -> bool;
974    pub fn m5u_rtc_clear_irq();
975    pub fn m5u_rtc_disable_irq();
976
977    pub fn m5u_power_axp192_begin() -> bool;
978    pub fn m5u_power_axp192_get_battery_level() -> c_int;
979    pub fn m5u_power_axp192_set_battery_charge(enable: bool) -> bool;
980    pub fn m5u_power_axp192_set_charge_current(max_ma: u16) -> bool;
981    pub fn m5u_power_axp192_set_charge_voltage(max_mv: u16) -> bool;
982    pub fn m5u_power_axp192_is_charging() -> bool;
983    pub fn m5u_power_axp192_set_dcdc(channel: u8, voltage_mv: c_int) -> bool;
984    pub fn m5u_power_axp192_set_ldo(channel: u8, voltage_mv: c_int) -> bool;
985    pub fn m5u_power_axp192_set_gpio(gpio_num: u8, state: bool) -> bool;
986    pub fn m5u_power_axp192_power_off() -> bool;
987    pub fn m5u_power_axp192_set_adc_state(enable: bool) -> bool;
988    pub fn m5u_power_axp192_set_adc_rate(rate: u8) -> bool;
989    pub fn m5u_power_axp192_set_exten(enable: bool) -> bool;
990    pub fn m5u_power_axp192_set_backup(enable: bool) -> bool;
991    pub fn m5u_power_axp192_is_acin() -> bool;
992    pub fn m5u_power_axp192_is_vbus() -> bool;
993    pub fn m5u_power_axp192_get_bat_state() -> bool;
994    pub fn m5u_power_axp192_get_exten() -> bool;
995    pub fn m5u_power_axp192_get_battery_voltage_v() -> c_float;
996    pub fn m5u_power_axp192_get_battery_discharge_current_ma() -> c_float;
997    pub fn m5u_power_axp192_get_battery_charge_current_ma() -> c_float;
998    pub fn m5u_power_axp192_get_battery_power_mw() -> c_float;
999    pub fn m5u_power_axp192_get_acin_voltage_v() -> c_float;
1000    pub fn m5u_power_axp192_get_acin_current_ma() -> c_float;
1001    pub fn m5u_power_axp192_get_vbus_voltage_v() -> c_float;
1002    pub fn m5u_power_axp192_get_vbus_current_ma() -> c_float;
1003    pub fn m5u_power_axp192_get_aps_voltage_v() -> c_float;
1004    pub fn m5u_power_axp192_get_internal_temperature_c() -> c_float;
1005    pub fn m5u_power_axp192_get_pek_press() -> u8;
1006    pub fn m5u_power_aw32001_begin() -> bool;
1007    pub fn m5u_power_aw32001_set_battery_charge(enable: bool) -> bool;
1008    pub fn m5u_power_aw32001_set_charge_current(max_ma: u16) -> bool;
1009    pub fn m5u_power_aw32001_set_charge_voltage(max_mv: u16) -> bool;
1010    pub fn m5u_power_aw32001_is_charging() -> bool;
1011    pub fn m5u_power_aw32001_get_charge_current() -> u16;
1012    pub fn m5u_power_aw32001_get_charge_voltage() -> u16;
1013    pub fn m5u_power_aw32001_get_charge_status() -> c_int;
1014    pub fn m5u_power_bq27220_begin() -> bool;
1015    pub fn m5u_power_bq27220_get_current_ma() -> i16;
1016    pub fn m5u_power_bq27220_get_voltage_mv() -> i16;
1017    pub fn m5u_power_bq27220_get_current_a() -> c_float;
1018    pub fn m5u_power_bq27220_get_voltage_v() -> c_float;
1019    pub fn m5u_power_ina226_begin() -> bool;
1020    pub fn m5u_power_ina226_config(config: *const m5u_power_ina226_config_t) -> bool;
1021    pub fn m5u_power_ina226_get_bus_voltage_v() -> c_float;
1022    pub fn m5u_power_ina226_get_shunt_voltage_v() -> c_float;
1023    pub fn m5u_power_ina226_get_shunt_current_a() -> c_float;
1024    pub fn m5u_power_ina226_get_power_w() -> c_float;
1025    pub fn m5u_power_ina3221_begin(index: usize) -> bool;
1026    pub fn m5u_power_ina3221_get_bus_voltage_v(index: usize, channel: u8) -> c_float;
1027    pub fn m5u_power_ina3221_get_shunt_voltage_v(index: usize, channel: u8) -> c_float;
1028    pub fn m5u_power_ina3221_get_current_a(index: usize, channel: u8) -> c_float;
1029    pub fn m5u_power_ina3221_get_bus_voltage_mv(index: usize, channel: u8) -> i32;
1030    pub fn m5u_power_ina3221_get_shunt_voltage_mv(index: usize, channel: u8) -> i32;
1031    pub fn m5u_power_ina3221_set_shunt_res(index: usize, channel: u8, res: u32) -> bool;
1032    pub fn m5u_power_ip5306_begin() -> bool;
1033    pub fn m5u_power_ip5306_get_battery_level() -> c_int;
1034    pub fn m5u_power_ip5306_set_battery_charge(enable: bool) -> bool;
1035    pub fn m5u_power_ip5306_set_charge_current(max_ma: u16) -> bool;
1036    pub fn m5u_power_ip5306_set_charge_voltage(max_mv: u16) -> bool;
1037    pub fn m5u_power_ip5306_is_charging() -> bool;
1038    pub fn m5u_power_ip5306_set_power_boost_keep_on(enable: bool) -> bool;
1039    pub fn m5u_power_py32pmic_begin() -> bool;
1040    pub fn m5u_power_py32pmic_set_ext_output(enable: bool) -> bool;
1041    pub fn m5u_power_py32pmic_set_battery_charge(enable: bool) -> bool;
1042    pub fn m5u_power_py32pmic_set_charge_current(max_ma: u16) -> bool;
1043    pub fn m5u_power_py32pmic_set_charge_voltage(max_mv: u16) -> bool;
1044    pub fn m5u_power_py32pmic_is_charging() -> bool;
1045    pub fn m5u_power_py32pmic_get_charge_current() -> u16;
1046    pub fn m5u_power_py32pmic_get_charge_voltage() -> u16;
1047    pub fn m5u_power_py32pmic_get_pek_press() -> u8;
1048    pub fn m5u_power_py32pmic_power_off() -> bool;
1049    pub fn m5u_power_axp2101_begin() -> bool;
1050    pub fn m5u_power_axp2101_get_battery_level() -> c_int;
1051    pub fn m5u_power_axp2101_set_battery_charge(enable: bool) -> bool;
1052    pub fn m5u_power_axp2101_set_pre_charge_current(max_ma: u16) -> bool;
1053    pub fn m5u_power_axp2101_set_charge_current(max_ma: u16) -> bool;
1054    pub fn m5u_power_axp2101_set_charge_voltage(max_mv: u16) -> bool;
1055    pub fn m5u_power_axp2101_get_charge_status() -> c_int;
1056    pub fn m5u_power_axp2101_is_charging() -> bool;
1057    pub fn m5u_power_axp2101_set_ldo(kind: c_int, channel: c_int, voltage_mv: c_int) -> bool;
1058    pub fn m5u_power_axp2101_get_ldo_enabled(kind: c_int, channel: c_int) -> bool;
1059    pub fn m5u_power_axp2101_power_off() -> bool;
1060    pub fn m5u_power_axp2101_set_adc_state(enable: bool) -> bool;
1061    pub fn m5u_power_axp2101_set_adc_rate(rate: u8) -> bool;
1062    pub fn m5u_power_axp2101_set_backup(enable: bool) -> bool;
1063    pub fn m5u_power_axp2101_is_acin() -> bool;
1064    pub fn m5u_power_axp2101_is_vbus() -> bool;
1065    pub fn m5u_power_axp2101_get_bat_state() -> bool;
1066    pub fn m5u_power_axp2101_get_battery_voltage_v() -> c_float;
1067    pub fn m5u_power_axp2101_get_battery_discharge_current_ma() -> c_float;
1068    pub fn m5u_power_axp2101_get_battery_charge_current_ma() -> c_float;
1069    pub fn m5u_power_axp2101_get_battery_power_mw() -> c_float;
1070    pub fn m5u_power_axp2101_get_acin_voltage_v() -> c_float;
1071    pub fn m5u_power_axp2101_get_acin_current_ma() -> c_float;
1072    pub fn m5u_power_axp2101_get_vbus_voltage_v() -> c_float;
1073    pub fn m5u_power_axp2101_get_vbus_current_ma() -> c_float;
1074    pub fn m5u_power_axp2101_get_ts_voltage_v() -> c_float;
1075    pub fn m5u_power_axp2101_get_aps_voltage_v() -> c_float;
1076    pub fn m5u_power_axp2101_get_internal_temperature_c() -> c_float;
1077    pub fn m5u_power_axp2101_get_pek_press() -> u8;
1078    pub fn m5u_power_axp2101_disable_irq(mask: u64) -> bool;
1079    pub fn m5u_power_axp2101_enable_irq(mask: u64) -> bool;
1080    pub fn m5u_power_axp2101_clear_irq_statuses() -> bool;
1081    pub fn m5u_power_axp2101_get_irq_statuses() -> u64;
1082    pub fn m5u_power_axp2101_is_bat_charger_under_temperature_irq() -> bool;
1083    pub fn m5u_power_axp2101_is_bat_charger_over_temperature_irq() -> bool;
1084    pub fn m5u_power_axp2101_is_vbus_insert_irq() -> bool;
1085    pub fn m5u_power_axp2101_is_vbus_remove_irq() -> bool;
1086
1087    pub fn m5u_led_begin() -> bool;
1088    pub fn m5u_led_display();
1089    pub fn m5u_led_set_auto_display(enable: bool);
1090    pub fn m5u_led_count() -> usize;
1091    pub fn m5u_led_set_brightness(brightness: u8);
1092    pub fn m5u_led_set_color_rgb(index: usize, r: u8, g: u8, b: u8);
1093    pub fn m5u_led_set_all_color_rgb(r: u8, g: u8, b: u8);
1094    pub fn m5u_led_set_colors_rgb(colors: *const m5u_led_color_t, index: usize, length: usize);
1095    pub fn m5u_led_get_type(index: usize) -> c_int;
1096    pub fn m5u_led_is_enabled() -> bool;
1097    pub fn m5u_led_power_hub_begin() -> bool;
1098    pub fn m5u_led_power_hub_count() -> usize;
1099    pub fn m5u_led_power_hub_set_brightness(brightness: u8);
1100    pub fn m5u_led_power_hub_set_color_rgb(index: usize, r: u8, g: u8, b: u8);
1101    pub fn m5u_led_power_hub_set_colors_rgb(
1102        colors: *const m5u_led_color_t,
1103        index: usize,
1104        length: usize,
1105    );
1106    pub fn m5u_led_power_hub_display();
1107    pub fn m5u_led_power_hub_get_type(index: usize) -> c_int;
1108    pub fn m5u_led_strip_set_config(config: *const m5u_led_strip_config_t) -> bool;
1109    pub fn m5u_led_strip_set_rmt_bus_config(config: *const m5u_led_strip_rmt_config_t) -> bool;
1110    pub fn m5u_led_strip_begin() -> bool;
1111    pub fn m5u_led_strip_count() -> usize;
1112    pub fn m5u_led_strip_set_brightness(brightness: u8);
1113    pub fn m5u_led_strip_set_color_rgb(index: usize, r: u8, g: u8, b: u8);
1114    pub fn m5u_led_strip_set_colors_rgb(
1115        colors: *const m5u_led_color_t,
1116        index: usize,
1117        length: usize,
1118    );
1119    pub fn m5u_led_strip_display();
1120    pub fn m5u_led_strip_get_type(index: usize) -> c_int;
1121
1122    pub fn m5u_log_print(text: *const c_char);
1123    pub fn m5u_log_println(text: *const c_char);
1124    pub fn m5u_log_println_empty();
1125    pub fn m5u_log_level(level: c_int, text: *const c_char);
1126    pub fn m5u_log_dump(addr: *const c_void, len: u32, level: c_int);
1127    pub fn m5u_log_path_to_file_name(path: *const c_char) -> *const c_char;
1128    pub fn m5u_log_set_callback(callback: m5u_log_callback_t, user_data: *mut c_void) -> bool;
1129    pub fn m5u_log_set_enable_color(target: c_int, enable: bool) -> bool;
1130    pub fn m5u_log_get_enable_color(target: c_int) -> bool;
1131    pub fn m5u_log_set_level(target: c_int, level: c_int) -> bool;
1132    pub fn m5u_log_get_level(target: c_int) -> c_int;
1133    pub fn m5u_log_set_suffix(target: c_int, suffix: *const c_char) -> bool;
1134    pub fn m5u_sd_begin() -> bool;
1135    pub fn m5u_sd_begin_spi(config: *const m5u_sd_spi_config_t) -> bool;
1136    pub fn m5u_sd_is_mounted() -> bool;
1137    pub fn m5u_sd_end();
1138}
1139
1140#[cfg(not(target_os = "espidf"))]
1141mod host_stubs {
1142    use super::*;
1143    use core::ptr;
1144
1145    pub unsafe fn m5u_begin() -> bool {
1146        true
1147    }
1148    pub unsafe fn m5u_begin_with_config(_config: *const m5u_config_t) -> bool {
1149        true
1150    }
1151    pub unsafe fn m5u_update() {}
1152    pub unsafe fn m5u_delay_ms(_ms: u32) {}
1153    pub unsafe fn m5u_millis() -> u32 {
1154        0
1155    }
1156    pub unsafe fn m5u_micros() -> u32 {
1157        0
1158    }
1159    pub unsafe fn m5u_get_update_msec() -> u32 {
1160        0
1161    }
1162    pub unsafe fn m5u_get_board() -> c_int {
1163        0
1164    }
1165    pub unsafe fn m5u_get_pin(_name: c_int) -> c_int {
1166        -1
1167    }
1168    pub unsafe fn m5u_set_primary_display_index(index: usize) -> bool {
1169        index == 0
1170    }
1171    pub unsafe fn m5u_set_primary_display_type(_kind: c_int) -> bool {
1172        false
1173    }
1174    pub unsafe fn m5u_set_primary_display_types(_kinds: *const c_int, _len: usize) -> bool {
1175        false
1176    }
1177    pub unsafe fn m5u_set_log_display_index(_index: usize) {}
1178    pub unsafe fn m5u_set_log_display_type(_kind: c_int) {}
1179    pub unsafe fn m5u_set_log_display_types(_kinds: *const c_int, _len: usize) {}
1180    pub unsafe fn m5u_set_touch_button_height(_pixel: u16) {}
1181    pub unsafe fn m5u_set_touch_button_height_by_ratio(_ratio: u8) {}
1182    pub unsafe fn m5u_get_touch_button_height() -> u16 {
1183        0
1184    }
1185
1186    pub unsafe fn m5u_io_expander_available(_index: usize) -> bool {
1187        false
1188    }
1189    pub unsafe fn m5u_io_expander_set_direction(_index: usize, _pin: u8, _output: bool) -> bool {
1190        false
1191    }
1192    pub unsafe fn m5u_io_expander_enable_pull(_index: usize, _pin: u8, _enable: bool) -> bool {
1193        false
1194    }
1195    pub unsafe fn m5u_io_expander_set_pull_mode(_index: usize, _pin: u8, _pull_up: bool) -> bool {
1196        false
1197    }
1198    pub unsafe fn m5u_io_expander_set_high_impedance(
1199        _index: usize,
1200        _pin: u8,
1201        _enable: bool,
1202    ) -> bool {
1203        false
1204    }
1205    pub unsafe fn m5u_io_expander_get_write_value(_index: usize, _pin: u8) -> bool {
1206        false
1207    }
1208    pub unsafe fn m5u_io_expander_digital_write(_index: usize, _pin: u8, _level: bool) -> bool {
1209        false
1210    }
1211    pub unsafe fn m5u_io_expander_digital_read(_index: usize, _pin: u8) -> bool {
1212        false
1213    }
1214    pub unsafe fn m5u_io_expander_reset_irq(_index: usize) -> bool {
1215        false
1216    }
1217    pub unsafe fn m5u_io_expander_disable_irq(_index: usize) -> bool {
1218        false
1219    }
1220    pub unsafe fn m5u_io_expander_enable_irq(_index: usize) -> bool {
1221        false
1222    }
1223    pub unsafe fn m5u_pi4ioe5v6408_begin() -> bool {
1224        false
1225    }
1226    pub unsafe fn m5u_pi4ioe5v6408_set_direction(_pin: u8, _output: bool) -> bool {
1227        false
1228    }
1229    pub unsafe fn m5u_pi4ioe5v6408_enable_pull(_pin: u8, _enable: bool) -> bool {
1230        false
1231    }
1232    pub unsafe fn m5u_pi4ioe5v6408_set_pull_mode(_pin: u8, _pull_up: bool) -> bool {
1233        false
1234    }
1235    pub unsafe fn m5u_pi4ioe5v6408_set_high_impedance(_pin: u8, _enable: bool) -> bool {
1236        false
1237    }
1238    pub unsafe fn m5u_pi4ioe5v6408_get_write_value(_pin: u8) -> bool {
1239        false
1240    }
1241    pub unsafe fn m5u_pi4ioe5v6408_digital_write(_pin: u8, _level: bool) -> bool {
1242        false
1243    }
1244    pub unsafe fn m5u_pi4ioe5v6408_digital_read(_pin: u8) -> bool {
1245        false
1246    }
1247    pub unsafe fn m5u_pi4ioe5v6408_reset_irq() {}
1248    pub unsafe fn m5u_pi4ioe5v6408_disable_irq() {}
1249    pub unsafe fn m5u_pi4ioe5v6408_enable_irq() {}
1250
1251    pub unsafe fn m5u_i2c_set_port(
1252        _bus: c_int,
1253        _port_num: c_int,
1254        _pin_sda: c_int,
1255        _pin_scl: c_int,
1256    ) {
1257    }
1258    pub unsafe fn m5u_i2c_begin(_bus: c_int) -> bool {
1259        false
1260    }
1261    pub unsafe fn m5u_i2c_begin_with_port(
1262        _bus: c_int,
1263        _port_num: c_int,
1264        _pin_sda: c_int,
1265        _pin_scl: c_int,
1266    ) -> bool {
1267        false
1268    }
1269    pub unsafe fn m5u_i2c_release(_bus: c_int) -> bool {
1270        false
1271    }
1272    pub unsafe fn m5u_i2c_is_enabled(_bus: c_int) -> bool {
1273        false
1274    }
1275    pub unsafe fn m5u_i2c_get_port(_bus: c_int) -> c_int {
1276        -1
1277    }
1278    pub unsafe fn m5u_i2c_get_sda(_bus: c_int) -> c_int {
1279        -1
1280    }
1281    pub unsafe fn m5u_i2c_get_scl(_bus: c_int) -> c_int {
1282        -1
1283    }
1284    pub unsafe fn m5u_i2c_start(_bus: c_int, _address: u8, _read: bool, _freq: u32) -> bool {
1285        false
1286    }
1287    pub unsafe fn m5u_i2c_restart(_bus: c_int, _address: u8, _read: bool, _freq: u32) -> bool {
1288        false
1289    }
1290    pub unsafe fn m5u_i2c_stop(_bus: c_int) -> bool {
1291        false
1292    }
1293    pub unsafe fn m5u_i2c_write_byte(_bus: c_int, _data: u8) -> bool {
1294        false
1295    }
1296    pub unsafe fn m5u_i2c_write(_bus: c_int, _data: *const u8, _length: usize) -> bool {
1297        false
1298    }
1299    pub unsafe fn m5u_i2c_read(
1300        _bus: c_int,
1301        result: *mut u8,
1302        length: usize,
1303        _last_nack: bool,
1304    ) -> bool {
1305        if !result.is_null() {
1306            for i in 0..length {
1307                ptr::write(result.add(i), 0);
1308            }
1309        }
1310        false
1311    }
1312    pub unsafe fn m5u_i2c_write_register(
1313        _bus: c_int,
1314        _address: u8,
1315        _reg: u8,
1316        _data: *const u8,
1317        _length: usize,
1318        _freq: u32,
1319    ) -> bool {
1320        false
1321    }
1322    pub unsafe fn m5u_i2c_read_register(
1323        _bus: c_int,
1324        _address: u8,
1325        _reg: u8,
1326        result: *mut u8,
1327        length: usize,
1328        _freq: u32,
1329    ) -> bool {
1330        if !result.is_null() {
1331            for i in 0..length {
1332                ptr::write(result.add(i), 0);
1333            }
1334        }
1335        false
1336    }
1337    pub unsafe fn m5u_i2c_write_register8(
1338        _bus: c_int,
1339        _address: u8,
1340        _reg: u8,
1341        _data: u8,
1342        _freq: u32,
1343    ) -> bool {
1344        false
1345    }
1346    pub unsafe fn m5u_i2c_read_register8(_bus: c_int, _address: u8, _reg: u8, _freq: u32) -> u8 {
1347        0
1348    }
1349    pub unsafe fn m5u_i2c_bit_on(
1350        _bus: c_int,
1351        _address: u8,
1352        _reg: u8,
1353        _data: u8,
1354        _freq: u32,
1355    ) -> bool {
1356        false
1357    }
1358    pub unsafe fn m5u_i2c_bit_off(
1359        _bus: c_int,
1360        _address: u8,
1361        _reg: u8,
1362        _data: u8,
1363        _freq: u32,
1364    ) -> bool {
1365        false
1366    }
1367    pub unsafe fn m5u_i2c_scan(_bus: c_int, result: *mut bool, _freq: u32) {
1368        if !result.is_null() {
1369            for i in 0..120 {
1370                ptr::write(result.add(i), false);
1371            }
1372        }
1373    }
1374    pub unsafe fn m5u_i2c_scan_address(_bus: c_int, _address: u8, _freq: u32) -> bool {
1375        false
1376    }
1377
1378    pub unsafe fn m5u_display_width() -> c_int {
1379        320
1380    }
1381    pub unsafe fn m5u_display_height() -> c_int {
1382        240
1383    }
1384    pub unsafe fn m5u_display_fill_screen(_color: u16) {}
1385    pub unsafe fn m5u_display_set_cursor(_x: c_int, _y: c_int) {}
1386    pub unsafe fn m5u_display_set_text_size(_size: c_int) {}
1387    pub unsafe fn m5u_display_set_text_color(_fg: u16, _bg: u16) {}
1388    pub unsafe fn m5u_display_print(_text: *const c_char) {}
1389    pub unsafe fn m5u_display_println(_text: *const c_char) {}
1390    pub unsafe fn m5u_display_draw_line(
1391        _x0: c_int,
1392        _y0: c_int,
1393        _x1: c_int,
1394        _y1: c_int,
1395        _color: u16,
1396    ) {
1397    }
1398    pub unsafe fn m5u_display_draw_rect(_x: c_int, _y: c_int, _w: c_int, _h: c_int, _color: u16) {}
1399    pub unsafe fn m5u_display_fill_rect(_x: c_int, _y: c_int, _w: c_int, _h: c_int, _color: u16) {}
1400    pub unsafe fn m5u_display_draw_circle(_x: c_int, _y: c_int, _r: c_int, _color: u16) {}
1401    pub unsafe fn m5u_display_fill_circle(_x: c_int, _y: c_int, _r: c_int, _color: u16) {}
1402    pub unsafe fn m5u_display_set_rotation(_rotation: c_int) {}
1403
1404    pub unsafe fn m5u_btn_a_is_pressed() -> bool {
1405        false
1406    }
1407    pub unsafe fn m5u_btn_a_was_pressed() -> bool {
1408        false
1409    }
1410    pub unsafe fn m5u_btn_a_was_released() -> bool {
1411        false
1412    }
1413    pub unsafe fn m5u_btn_b_is_pressed() -> bool {
1414        false
1415    }
1416    pub unsafe fn m5u_btn_b_was_pressed() -> bool {
1417        false
1418    }
1419    pub unsafe fn m5u_btn_b_was_released() -> bool {
1420        false
1421    }
1422    pub unsafe fn m5u_btn_c_is_pressed() -> bool {
1423        false
1424    }
1425    pub unsafe fn m5u_btn_c_was_pressed() -> bool {
1426        false
1427    }
1428    pub unsafe fn m5u_btn_c_was_released() -> bool {
1429        false
1430    }
1431
1432    pub unsafe fn m5u_mic_begin() -> bool {
1433        true
1434    }
1435    pub unsafe fn m5u_mic_record_i16(buffer: *mut i16, samples: usize) -> bool {
1436        if !buffer.is_null() {
1437            for i in 0..samples {
1438                ptr::write(buffer.add(i), 0);
1439            }
1440        }
1441        true
1442    }
1443    pub unsafe fn m5u_mic_record_u8(buffer: *mut u8, samples: usize) -> bool {
1444        if !buffer.is_null() {
1445            for i in 0..samples {
1446                ptr::write(buffer.add(i), 0);
1447            }
1448        }
1449        true
1450    }
1451    pub unsafe fn m5u_speaker_begin() -> bool {
1452        true
1453    }
1454    pub unsafe fn m5u_speaker_set_volume(_volume: u8) {}
1455    pub unsafe fn m5u_speaker_tone(_frequency_hz: u32, _duration_ms: u32) -> bool {
1456        true
1457    }
1458    pub unsafe fn m5u_speaker_play_i16(
1459        _samples: *const i16,
1460        _len: usize,
1461        _sample_rate_hz: u32,
1462    ) -> bool {
1463        true
1464    }
1465
1466    pub unsafe fn m5u_imu_begin() -> bool {
1467        true
1468    }
1469    pub unsafe fn m5u_imu_begin_for_board(_board: c_int) -> bool {
1470        false
1471    }
1472    pub unsafe fn m5u_imu_get_accel(x: *mut f32, y: *mut f32, z: *mut f32) -> bool {
1473        if !x.is_null() {
1474            *x = 0.0;
1475        }
1476        if !y.is_null() {
1477            *y = 0.0;
1478        }
1479        if !z.is_null() {
1480            *z = 1.0;
1481        }
1482        true
1483    }
1484    pub unsafe fn m5u_imu_get_gyro(x: *mut f32, y: *mut f32, z: *mut f32) -> bool {
1485        if !x.is_null() {
1486            *x = 0.0;
1487        }
1488        if !y.is_null() {
1489            *y = 0.0;
1490        }
1491        if !z.is_null() {
1492            *z = 0.0;
1493        }
1494        true
1495    }
1496    pub unsafe fn m5u_imu_get_mag(x: *mut f32, y: *mut f32, z: *mut f32) -> bool {
1497        if !x.is_null() {
1498            *x = 0.0;
1499        }
1500        if !y.is_null() {
1501            *y = 0.0;
1502        }
1503        if !z.is_null() {
1504            *z = 0.0;
1505        }
1506        true
1507    }
1508    pub unsafe fn m5u_imu_get_data(out: *mut m5u_imu_data_t) -> bool {
1509        if !out.is_null() {
1510            *out = m5u_imu_data_t {
1511                accel_z: 1.0,
1512                ..m5u_imu_data_t::default()
1513            };
1514        }
1515        true
1516    }
1517    pub unsafe fn m5u_imu_get_temp_c(temp: *mut f32) -> bool {
1518        if !temp.is_null() {
1519            *temp = 25.0;
1520        }
1521        true
1522    }
1523
1524    pub unsafe fn m5u_touch_count() -> c_int {
1525        0
1526    }
1527    pub unsafe fn m5u_touch_get(_index: c_int, _x: *mut c_int, _y: *mut c_int) -> bool {
1528        false
1529    }
1530    pub unsafe fn m5u_touch_get_raw(_index: c_int, _x: *mut c_int, _y: *mut c_int) -> bool {
1531        false
1532    }
1533
1534    pub unsafe fn m5u_rtc_begin() -> bool {
1535        true
1536    }
1537    pub unsafe fn m5u_rtc_begin_for_board(_board: c_int) -> bool {
1538        true
1539    }
1540    pub unsafe fn m5u_rtc_is_enabled() -> bool {
1541        true
1542    }
1543    pub unsafe fn m5u_rtc_get_volt_low() -> bool {
1544        false
1545    }
1546    pub unsafe fn m5u_rtc_get_datetime(
1547        year: *mut c_int,
1548        month: *mut c_int,
1549        day: *mut c_int,
1550        hour: *mut c_int,
1551        minute: *mut c_int,
1552        second: *mut c_int,
1553    ) -> bool {
1554        if !year.is_null() {
1555            *year = 2026;
1556        }
1557        if !month.is_null() {
1558            *month = 1;
1559        }
1560        if !day.is_null() {
1561            *day = 1;
1562        }
1563        if !hour.is_null() {
1564            *hour = 0;
1565        }
1566        if !minute.is_null() {
1567            *minute = 0;
1568        }
1569        if !second.is_null() {
1570            *second = 0;
1571        }
1572        true
1573    }
1574    pub unsafe fn m5u_rtc_get_datetime_detail(out: *mut m5u_rtc_datetime_t) -> bool {
1575        if !out.is_null() {
1576            *out = m5u_rtc_datetime_t::default();
1577        }
1578        true
1579    }
1580    pub unsafe fn m5u_rtc_get_date_detail(out: *mut m5u_rtc_datetime_t) -> bool {
1581        m5u_rtc_get_datetime_detail(out)
1582    }
1583    pub unsafe fn m5u_rtc_get_time_detail(out: *mut m5u_rtc_datetime_t) -> bool {
1584        m5u_rtc_get_datetime_detail(out)
1585    }
1586    pub unsafe fn m5u_rtc_set_datetime(
1587        _year: c_int,
1588        _month: c_int,
1589        _day: c_int,
1590        _hour: c_int,
1591        _minute: c_int,
1592        _second: c_int,
1593    ) -> bool {
1594        true
1595    }
1596    pub unsafe fn m5u_rtc_set_datetime_detail(datetime: *const m5u_rtc_datetime_t) -> bool {
1597        !datetime.is_null()
1598    }
1599    pub unsafe fn m5u_rtc_set_date_detail(date: *const m5u_rtc_datetime_t) -> bool {
1600        !date.is_null()
1601    }
1602    pub unsafe fn m5u_rtc_set_time_detail(time: *const m5u_rtc_datetime_t) -> bool {
1603        !time.is_null()
1604    }
1605    pub unsafe fn m5u_rtc_device_begin(_kind: c_int) -> bool {
1606        false
1607    }
1608    pub unsafe fn m5u_rtc_device_get_datetime_detail(
1609        _kind: c_int,
1610        _out: *mut m5u_rtc_datetime_t,
1611    ) -> bool {
1612        false
1613    }
1614    pub unsafe fn m5u_rtc_device_get_date_detail(
1615        _kind: c_int,
1616        _out: *mut m5u_rtc_datetime_t,
1617    ) -> bool {
1618        false
1619    }
1620    pub unsafe fn m5u_rtc_device_get_time_detail(
1621        _kind: c_int,
1622        _out: *mut m5u_rtc_datetime_t,
1623    ) -> bool {
1624        false
1625    }
1626    pub unsafe fn m5u_rtc_device_set_datetime_detail(
1627        _kind: c_int,
1628        _datetime: *const m5u_rtc_datetime_t,
1629    ) -> bool {
1630        false
1631    }
1632    pub unsafe fn m5u_rtc_device_set_date_detail(
1633        _kind: c_int,
1634        _date: *const m5u_rtc_datetime_t,
1635    ) -> bool {
1636        false
1637    }
1638    pub unsafe fn m5u_rtc_device_set_time_detail(
1639        _kind: c_int,
1640        _time: *const m5u_rtc_datetime_t,
1641    ) -> bool {
1642        false
1643    }
1644    pub unsafe fn m5u_rtc_device_get_volt_low(_kind: c_int) -> bool {
1645        false
1646    }
1647    pub unsafe fn m5u_rtc_device_set_timer_irq(_kind: c_int, _timer_msec: u32) -> u32 {
1648        0
1649    }
1650    pub unsafe fn m5u_rtc_device_set_alarm_irq_datetime(
1651        _kind: c_int,
1652        _datetime: *const m5u_rtc_datetime_t,
1653    ) -> c_int {
1654        -1
1655    }
1656    pub unsafe fn m5u_rtc_device_set_alarm_irq_time(
1657        _kind: c_int,
1658        _time: *const m5u_rtc_datetime_t,
1659    ) -> c_int {
1660        -1
1661    }
1662    pub unsafe fn m5u_rtc_device_get_irq_status(_kind: c_int) -> bool {
1663        false
1664    }
1665    pub unsafe fn m5u_rtc_device_clear_irq(_kind: c_int) {}
1666    pub unsafe fn m5u_rtc_device_disable_irq(_kind: c_int) {}
1667
1668    pub unsafe fn m5u_battery_level() -> c_int {
1669        100
1670    }
1671    pub unsafe fn m5u_battery_voltage_mv() -> c_int {
1672        4200
1673    }
1674    pub unsafe fn m5u_power_begin() -> bool {
1675        false
1676    }
1677    pub unsafe fn m5u_power_get_type() -> c_int {
1678        0
1679    }
1680    pub unsafe fn m5u_power_get_charge_state() -> c_int {
1681        2
1682    }
1683    pub unsafe fn m5u_power_is_charging() -> bool {
1684        false
1685    }
1686    pub unsafe fn m5u_power_set_led(_brightness: u8) {}
1687    pub unsafe fn m5u_power_set_ext_output(_enable: bool, _port_mask: u16) {}
1688    pub unsafe fn m5u_power_get_ext_output() -> bool {
1689        false
1690    }
1691    pub unsafe fn m5u_power_set_usb_output(_enable: bool) {}
1692    pub unsafe fn m5u_power_get_usb_output() -> bool {
1693        false
1694    }
1695    pub unsafe fn m5u_power_set_battery_charge(_enable: bool) {}
1696    pub unsafe fn m5u_power_set_charge_current(_max_ma: u16) {}
1697    pub unsafe fn m5u_power_set_charge_voltage(_max_mv: u16) {}
1698    pub unsafe fn m5u_power_get_vbus_voltage_mv() -> c_int {
1699        -1
1700    }
1701    pub unsafe fn m5u_power_get_battery_current_ma() -> c_int {
1702        0
1703    }
1704    pub unsafe fn m5u_power_get_ext_voltage_mv(_port_mask: u16) -> c_float {
1705        0.0
1706    }
1707    pub unsafe fn m5u_power_get_ext_current_ma(_port_mask: u16) -> c_float {
1708        0.0
1709    }
1710    pub unsafe fn m5u_power_get_key_state() -> u8 {
1711        0
1712    }
1713    pub unsafe fn m5u_power_set_ext_port_bus_config(_config: *const m5u_power_ext_port_bus_t) {}
1714    pub unsafe fn m5u_power_set_vibration(_level: u8) {}
1715    pub unsafe fn m5u_power_power_off() {}
1716    pub unsafe fn m5u_power_timer_sleep_seconds(_seconds: c_int) {}
1717    pub unsafe fn m5u_power_timer_sleep_time(_time: *const m5u_rtc_datetime_t) {}
1718    pub unsafe fn m5u_power_timer_sleep_date_time(
1719        _date: *const m5u_rtc_datetime_t,
1720        _time: *const m5u_rtc_datetime_t,
1721    ) {
1722    }
1723    pub unsafe fn m5u_power_deep_sleep_us(_micro_seconds: u64, _touch_wakeup: bool) {}
1724    pub unsafe fn m5u_power_light_sleep_us(_micro_seconds: u64, _touch_wakeup: bool) {}
1725
1726    pub unsafe fn m5u_display_get_rotation() -> c_int {
1727        0
1728    }
1729    pub unsafe fn m5u_display_set_brightness(_brightness: u8) {}
1730    pub unsafe fn m5u_display_set_epd_fastest() {}
1731    pub unsafe fn m5u_display_set_epd_mode(_mode: c_int) {}
1732    pub unsafe fn m5u_display_set_text_scroll(_scroll: bool) {}
1733    pub unsafe fn m5u_display_set_font(font: c_int) -> bool {
1734        (0..=3).contains(&font)
1735    }
1736    pub unsafe fn m5u_display_start_write() {}
1737    pub unsafe fn m5u_display_end_write() {}
1738    pub unsafe fn m5u_display_display() {}
1739    pub unsafe fn m5u_display_display_busy() -> bool {
1740        false
1741    }
1742    pub unsafe fn m5u_display_wait_display() {}
1743    pub unsafe fn m5u_display_get_cursor_y() -> c_int {
1744        0
1745    }
1746    pub unsafe fn m5u_display_font_height() -> c_int {
1747        16
1748    }
1749    pub unsafe fn m5u_display_get_base_color() -> u16 {
1750        0
1751    }
1752    pub unsafe fn m5u_display_set_color(_color: u16) {}
1753    pub unsafe fn m5u_display_set_text_wrap(_wrap_x: bool, _wrap_y: bool) {}
1754    pub unsafe fn m5u_display_set_text_datum(_datum: c_int) {}
1755    pub unsafe fn m5u_display_draw_string(_text: *const c_char, _x: c_int, _y: c_int) -> c_int {
1756        0
1757    }
1758    pub unsafe fn m5u_display_draw_pixel(_x: c_int, _y: c_int, _color: u16) {}
1759    pub unsafe fn m5u_display_write_pixel(_x: c_int, _y: c_int, _color: u16) {}
1760    pub unsafe fn m5u_display_draw_fast_hline(_x: c_int, _y: c_int, _w: c_int, _color: u16) {}
1761    pub unsafe fn m5u_display_write_fast_hline(_x: c_int, _y: c_int, _w: c_int, _color: u16) {}
1762    pub unsafe fn m5u_display_draw_fast_vline(_x: c_int, _y: c_int, _h: c_int, _color: u16) {}
1763    pub unsafe fn m5u_display_write_fast_vline(_x: c_int, _y: c_int, _h: c_int, _color: u16) {}
1764    pub unsafe fn m5u_display_draw_round_rect(
1765        _x: c_int,
1766        _y: c_int,
1767        _w: c_int,
1768        _h: c_int,
1769        _r: c_int,
1770        _color: u16,
1771    ) {
1772    }
1773    pub unsafe fn m5u_display_fill_round_rect(
1774        _x: c_int,
1775        _y: c_int,
1776        _w: c_int,
1777        _h: c_int,
1778        _r: c_int,
1779        _color: u16,
1780    ) {
1781    }
1782    pub unsafe fn m5u_display_draw_triangle(
1783        _x0: c_int,
1784        _y0: c_int,
1785        _x1: c_int,
1786        _y1: c_int,
1787        _x2: c_int,
1788        _y2: c_int,
1789        _color: u16,
1790    ) {
1791    }
1792    pub unsafe fn m5u_display_fill_triangle(
1793        _x0: c_int,
1794        _y0: c_int,
1795        _x1: c_int,
1796        _y1: c_int,
1797        _x2: c_int,
1798        _y2: c_int,
1799        _color: u16,
1800    ) {
1801    }
1802    pub unsafe fn m5u_display_draw_ellipse(
1803        _x: c_int,
1804        _y: c_int,
1805        _rx: c_int,
1806        _ry: c_int,
1807        _color: u16,
1808    ) {
1809    }
1810    pub unsafe fn m5u_display_fill_ellipse(
1811        _x: c_int,
1812        _y: c_int,
1813        _rx: c_int,
1814        _ry: c_int,
1815        _color: u16,
1816    ) {
1817    }
1818    pub unsafe fn m5u_display_draw_arc(
1819        _x: c_int,
1820        _y: c_int,
1821        _r0: c_int,
1822        _r1: c_int,
1823        _angle0: c_float,
1824        _angle1: c_float,
1825        _color: u16,
1826    ) {
1827    }
1828    pub unsafe fn m5u_display_fill_arc(
1829        _x: c_int,
1830        _y: c_int,
1831        _r0: c_int,
1832        _r1: c_int,
1833        _angle0: c_float,
1834        _angle1: c_float,
1835        _color: u16,
1836    ) {
1837    }
1838    pub unsafe fn m5u_display_set_scroll_rect(_x: c_int, _y: c_int, _w: c_int, _h: c_int) {}
1839    pub unsafe fn m5u_display_set_scroll_rect_color(
1840        _x: c_int,
1841        _y: c_int,
1842        _w: c_int,
1843        _h: c_int,
1844        _color: u16,
1845    ) {
1846    }
1847    pub unsafe fn m5u_display_scroll(_dx: c_int, _dy: c_int) {}
1848    pub unsafe fn m5u_display_text_width(_text: *const c_char) -> c_int {
1849        0
1850    }
1851    pub unsafe fn m5u_display_get_text_datum() -> c_int {
1852        0
1853    }
1854    pub unsafe fn m5u_display_set_text_padding(_padding: u32) {}
1855    pub unsafe fn m5u_display_get_text_padding() -> u32 {
1856        0
1857    }
1858    pub unsafe fn m5u_display_get_text_size_x() -> c_float {
1859        1.0
1860    }
1861    pub unsafe fn m5u_display_get_text_size_y() -> c_float {
1862        1.0
1863    }
1864    pub unsafe fn m5u_display_set_clip_rect(_x: c_int, _y: c_int, _w: c_int, _h: c_int) {}
1865    pub unsafe fn m5u_display_clear_clip_rect() {}
1866    pub unsafe fn m5u_display_color888(r: u8, g: u8, b: u8) -> u16 {
1867        ((u16::from(r & 0xF8)) << 8) | ((u16::from(g & 0xFC)) << 3) | u16::from(b >> 3)
1868    }
1869    pub unsafe fn m5u_display_count() -> c_int {
1870        1
1871    }
1872    pub unsafe fn m5u_display_index_for_kind(_kind: c_int) -> c_int {
1873        -1
1874    }
1875    pub unsafe fn m5u_display_index_for_kinds(_kinds: *const c_int, _len: usize) -> c_int {
1876        -1
1877    }
1878    pub unsafe fn m5u_display_width_at(_index: c_int) -> c_int {
1879        320
1880    }
1881    pub unsafe fn m5u_display_height_at(_index: c_int) -> c_int {
1882        240
1883    }
1884    pub unsafe fn m5u_display_fill_screen_at(_index: c_int, _color: u16) {}
1885    pub unsafe fn m5u_display_set_cursor_at(_index: c_int, _x: c_int, _y: c_int) {}
1886    pub unsafe fn m5u_display_set_text_size_at(_index: c_int, _size: c_int) {}
1887    pub unsafe fn m5u_display_set_text_color_at(_index: c_int, _fg: u16, _bg: u16) {}
1888    pub unsafe fn m5u_display_get_rotation_at(_index: c_int) -> c_int {
1889        0
1890    }
1891    pub unsafe fn m5u_display_set_rotation_at(_index: c_int, _rotation: c_int) {}
1892    pub unsafe fn m5u_display_set_color_at(_index: c_int, _color: u16) {}
1893    pub unsafe fn m5u_display_start_write_at(_index: c_int) {}
1894    pub unsafe fn m5u_display_end_write_at(_index: c_int) {}
1895    pub unsafe fn m5u_display_print_at(_index: c_int, _text: *const c_char) {}
1896    pub unsafe fn m5u_display_println_at(_index: c_int, _text: *const c_char) {}
1897    pub unsafe fn m5u_display_draw_string_at(
1898        _index: c_int,
1899        _text: *const c_char,
1900        _x: c_int,
1901        _y: c_int,
1902    ) -> c_int {
1903        0
1904    }
1905    pub unsafe fn m5u_display_draw_line_at(
1906        _index: c_int,
1907        _x0: c_int,
1908        _y0: c_int,
1909        _x1: c_int,
1910        _y1: c_int,
1911        _color: u16,
1912    ) {
1913    }
1914    pub unsafe fn m5u_display_draw_rect_at(
1915        _index: c_int,
1916        _x: c_int,
1917        _y: c_int,
1918        _w: c_int,
1919        _h: c_int,
1920        _color: u16,
1921    ) {
1922    }
1923    pub unsafe fn m5u_display_fill_rect_at(
1924        _index: c_int,
1925        _x: c_int,
1926        _y: c_int,
1927        _w: c_int,
1928        _h: c_int,
1929        _color: u16,
1930    ) {
1931    }
1932    pub unsafe fn m5u_display_draw_circle_at(
1933        _index: c_int,
1934        _x: c_int,
1935        _y: c_int,
1936        _r: c_int,
1937        _color: u16,
1938    ) {
1939    }
1940    pub unsafe fn m5u_display_fill_circle_at(
1941        _index: c_int,
1942        _x: c_int,
1943        _y: c_int,
1944        _r: c_int,
1945        _color: u16,
1946    ) {
1947    }
1948    pub unsafe fn m5u_display_write_pixel_at(_index: c_int, _x: c_int, _y: c_int, _color: u16) {}
1949    pub unsafe fn m5u_display_draw_pixel_at(_index: c_int, _x: c_int, _y: c_int, _color: u16) {}
1950    pub unsafe fn m5u_display_draw_fast_hline_at(
1951        _index: c_int,
1952        _x: c_int,
1953        _y: c_int,
1954        _w: c_int,
1955        _color: u16,
1956    ) {
1957    }
1958    pub unsafe fn m5u_display_write_fast_hline_at(
1959        _index: c_int,
1960        _x: c_int,
1961        _y: c_int,
1962        _w: c_int,
1963        _color: u16,
1964    ) {
1965    }
1966    pub unsafe fn m5u_display_draw_fast_vline_at(
1967        _index: c_int,
1968        _x: c_int,
1969        _y: c_int,
1970        _h: c_int,
1971        _color: u16,
1972    ) {
1973    }
1974    pub unsafe fn m5u_display_write_fast_vline_at(
1975        _index: c_int,
1976        _x: c_int,
1977        _y: c_int,
1978        _h: c_int,
1979        _color: u16,
1980    ) {
1981    }
1982    pub unsafe fn m5u_display_draw_round_rect_at(
1983        _index: c_int,
1984        _x: c_int,
1985        _y: c_int,
1986        _w: c_int,
1987        _h: c_int,
1988        _r: c_int,
1989        _color: u16,
1990    ) {
1991    }
1992    pub unsafe fn m5u_display_fill_round_rect_at(
1993        _index: c_int,
1994        _x: c_int,
1995        _y: c_int,
1996        _w: c_int,
1997        _h: c_int,
1998        _r: c_int,
1999        _color: u16,
2000    ) {
2001    }
2002    pub unsafe fn m5u_display_draw_triangle_at(
2003        _index: c_int,
2004        _x0: c_int,
2005        _y0: c_int,
2006        _x1: c_int,
2007        _y1: c_int,
2008        _x2: c_int,
2009        _y2: c_int,
2010        _color: u16,
2011    ) {
2012    }
2013    pub unsafe fn m5u_display_fill_triangle_at(
2014        _index: c_int,
2015        _x0: c_int,
2016        _y0: c_int,
2017        _x1: c_int,
2018        _y1: c_int,
2019        _x2: c_int,
2020        _y2: c_int,
2021        _color: u16,
2022    ) {
2023    }
2024    pub unsafe fn m5u_display_draw_ellipse_at(
2025        _index: c_int,
2026        _x: c_int,
2027        _y: c_int,
2028        _rx: c_int,
2029        _ry: c_int,
2030        _color: u16,
2031    ) {
2032    }
2033    pub unsafe fn m5u_display_fill_ellipse_at(
2034        _index: c_int,
2035        _x: c_int,
2036        _y: c_int,
2037        _rx: c_int,
2038        _ry: c_int,
2039        _color: u16,
2040    ) {
2041    }
2042    pub unsafe fn m5u_display_draw_arc_at(
2043        _index: c_int,
2044        _x: c_int,
2045        _y: c_int,
2046        _r0: c_int,
2047        _r1: c_int,
2048        _angle0: c_float,
2049        _angle1: c_float,
2050        _color: u16,
2051    ) {
2052    }
2053    pub unsafe fn m5u_display_fill_arc_at(
2054        _index: c_int,
2055        _x: c_int,
2056        _y: c_int,
2057        _r0: c_int,
2058        _r1: c_int,
2059        _angle0: c_float,
2060        _angle1: c_float,
2061        _color: u16,
2062    ) {
2063    }
2064    pub unsafe fn m5u_display_set_scroll_rect_at(
2065        _index: c_int,
2066        _x: c_int,
2067        _y: c_int,
2068        _w: c_int,
2069        _h: c_int,
2070    ) {
2071    }
2072    pub unsafe fn m5u_display_set_scroll_rect_color_at(
2073        _index: c_int,
2074        _x: c_int,
2075        _y: c_int,
2076        _w: c_int,
2077        _h: c_int,
2078        _color: u16,
2079    ) {
2080    }
2081    pub unsafe fn m5u_display_scroll_at(_index: c_int, _dx: c_int, _dy: c_int) {}
2082    pub unsafe fn m5u_display_text_width_at(_index: c_int, _text: *const c_char) -> c_int {
2083        0
2084    }
2085    pub unsafe fn m5u_display_get_text_datum_at(_index: c_int) -> c_int {
2086        0
2087    }
2088    pub unsafe fn m5u_display_set_text_padding_at(_index: c_int, _padding: u32) {}
2089    pub unsafe fn m5u_display_get_text_padding_at(_index: c_int) -> u32 {
2090        0
2091    }
2092    pub unsafe fn m5u_display_get_text_size_x_at(_index: c_int) -> c_float {
2093        1.0
2094    }
2095    pub unsafe fn m5u_display_get_text_size_y_at(_index: c_int) -> c_float {
2096        1.0
2097    }
2098
2099    pub unsafe fn m5u_button_is_pressed(_button: c_int) -> bool {
2100        false
2101    }
2102    pub unsafe fn m5u_button_was_pressed(_button: c_int) -> bool {
2103        false
2104    }
2105    pub unsafe fn m5u_button_was_released(_button: c_int) -> bool {
2106        false
2107    }
2108    pub unsafe fn m5u_button_was_clicked(_button: c_int) -> bool {
2109        false
2110    }
2111    pub unsafe fn m5u_button_was_hold(_button: c_int) -> bool {
2112        false
2113    }
2114    pub unsafe fn m5u_button_is_holding(_button: c_int) -> bool {
2115        false
2116    }
2117    pub unsafe fn m5u_button_was_decide_click_count(_button: c_int) -> bool {
2118        false
2119    }
2120    pub unsafe fn m5u_button_get_click_count(_button: c_int) -> c_int {
2121        0
2122    }
2123    pub unsafe fn m5u_button_was_single_clicked(_button: c_int) -> bool {
2124        false
2125    }
2126    pub unsafe fn m5u_button_was_double_clicked(_button: c_int) -> bool {
2127        false
2128    }
2129    pub unsafe fn m5u_button_was_change_pressed(_button: c_int) -> bool {
2130        false
2131    }
2132    pub unsafe fn m5u_button_is_released(_button: c_int) -> bool {
2133        true
2134    }
2135    pub unsafe fn m5u_button_was_released_after_hold(_button: c_int) -> bool {
2136        false
2137    }
2138    pub unsafe fn m5u_button_was_release_for(_button: c_int, _ms: u32) -> bool {
2139        false
2140    }
2141    pub unsafe fn m5u_button_pressed_for(_button: c_int, _ms: u32) -> bool {
2142        false
2143    }
2144    pub unsafe fn m5u_button_released_for(_button: c_int, _ms: u32) -> bool {
2145        true
2146    }
2147    pub unsafe fn m5u_button_set_debounce_thresh(_button: c_int, _ms: u32) {}
2148    pub unsafe fn m5u_button_set_hold_thresh(_button: c_int, _ms: u32) {}
2149    pub unsafe fn m5u_button_set_raw_state(_button: c_int, _msec: u32, _press: bool) {}
2150    pub unsafe fn m5u_button_set_state(_button: c_int, _msec: u32, _state: u8) {}
2151    pub unsafe fn m5u_button_get_state(_button: c_int) -> u8 {
2152        0
2153    }
2154    pub unsafe fn m5u_button_last_change(_button: c_int) -> u32 {
2155        0
2156    }
2157    pub unsafe fn m5u_button_get_debounce_thresh(_button: c_int) -> u32 {
2158        10
2159    }
2160    pub unsafe fn m5u_button_get_hold_thresh(_button: c_int) -> u32 {
2161        500
2162    }
2163    pub unsafe fn m5u_button_get_update_msec(_button: c_int) -> u32 {
2164        0
2165    }
2166
2167    pub unsafe fn m5u_mic_is_enabled() -> bool {
2168        true
2169    }
2170    pub unsafe fn m5u_mic_is_running() -> bool {
2171        false
2172    }
2173    pub unsafe fn m5u_mic_is_recording() -> bool {
2174        false
2175    }
2176    pub unsafe fn m5u_mic_recording_state() -> usize {
2177        0
2178    }
2179    pub unsafe fn m5u_mic_end() {}
2180    pub unsafe fn m5u_mic_record_i16_at(
2181        buffer: *mut i16,
2182        samples: usize,
2183        _sample_rate_hz: u32,
2184    ) -> bool {
2185        m5u_mic_record_i16(buffer, samples)
2186    }
2187    pub unsafe fn m5u_mic_record_i16_ex(
2188        buffer: *mut i16,
2189        samples: usize,
2190        _sample_rate_hz: u32,
2191        _stereo: bool,
2192    ) -> bool {
2193        m5u_mic_record_i16(buffer, samples)
2194    }
2195    pub unsafe fn m5u_mic_record_u8_ex(
2196        buffer: *mut u8,
2197        samples: usize,
2198        _sample_rate_hz: u32,
2199        _stereo: bool,
2200    ) -> bool {
2201        m5u_mic_record_u8(buffer, samples)
2202    }
2203    pub unsafe fn m5u_mic_set_sample_rate(_sample_rate_hz: u32) {}
2204    pub unsafe fn m5u_mic_get_noise_filter_level() -> c_int {
2205        0
2206    }
2207    pub unsafe fn m5u_mic_set_noise_filter_level(_level: c_int) -> bool {
2208        true
2209    }
2210    pub unsafe fn m5u_mic_get_config(out: *mut m5u_mic_config_t) -> bool {
2211        if !out.is_null() {
2212            *out = m5u_mic_config_t::default();
2213        }
2214        true
2215    }
2216    pub unsafe fn m5u_mic_set_config(config: *const m5u_mic_config_t) -> bool {
2217        !config.is_null()
2218    }
2219
2220    pub unsafe fn m5u_speaker_is_enabled() -> bool {
2221        true
2222    }
2223    pub unsafe fn m5u_speaker_is_running() -> bool {
2224        false
2225    }
2226    pub unsafe fn m5u_speaker_end() {}
2227    pub unsafe fn m5u_speaker_get_volume() -> u8 {
2228        64
2229    }
2230    pub unsafe fn m5u_speaker_get_config(out: *mut m5u_speaker_config_t) -> bool {
2231        if !out.is_null() {
2232            *out = m5u_speaker_config_t::default();
2233        }
2234        true
2235    }
2236    pub unsafe fn m5u_speaker_set_config(config: *const m5u_speaker_config_t) -> bool {
2237        !config.is_null()
2238    }
2239    pub unsafe fn m5u_speaker_tone_ex(
2240        _frequency_hz: c_float,
2241        _duration_ms: u32,
2242        _channel: c_int,
2243    ) -> bool {
2244        true
2245    }
2246    pub unsafe fn m5u_speaker_tone_options(
2247        _frequency_hz: c_float,
2248        _duration_ms: u32,
2249        _channel: c_int,
2250        _stop_current_sound: bool,
2251    ) -> bool {
2252        true
2253    }
2254    pub unsafe fn m5u_speaker_tone_full(
2255        _frequency_hz: c_float,
2256        _duration_ms: u32,
2257        _channel: c_int,
2258        _stop_current_sound: bool,
2259        _raw_data: *const u8,
2260        _len: usize,
2261        _stereo: bool,
2262    ) -> bool {
2263        true
2264    }
2265    pub unsafe fn m5u_speaker_play_u8(
2266        _samples: *const u8,
2267        _len: usize,
2268        _sample_rate_hz: u32,
2269    ) -> bool {
2270        true
2271    }
2272    pub unsafe fn m5u_speaker_play_u8_ex(
2273        _samples: *const u8,
2274        _len: usize,
2275        _sample_rate_hz: u32,
2276        _stereo: bool,
2277        _repeat: u32,
2278        _channel: c_int,
2279        _stop_current_sound: bool,
2280    ) -> bool {
2281        true
2282    }
2283    pub unsafe fn m5u_speaker_play_i8_ex(
2284        _samples: *const i8,
2285        _len: usize,
2286        _sample_rate_hz: u32,
2287        _stereo: bool,
2288        _repeat: u32,
2289        _channel: c_int,
2290        _stop_current_sound: bool,
2291    ) -> bool {
2292        true
2293    }
2294    pub unsafe fn m5u_speaker_play_i16_ex(
2295        _samples: *const i16,
2296        _len: usize,
2297        _sample_rate_hz: u32,
2298        _stereo: bool,
2299        _repeat: u32,
2300        _channel: c_int,
2301        _stop_current_sound: bool,
2302    ) -> bool {
2303        true
2304    }
2305    pub unsafe fn m5u_speaker_play_wav(_data: *const u8, _len: usize) -> bool {
2306        true
2307    }
2308    pub unsafe fn m5u_speaker_play_wav_ex(
2309        _data: *const u8,
2310        _len: usize,
2311        _repeat: u32,
2312        _channel: c_int,
2313        _stop_current_sound: bool,
2314    ) -> bool {
2315        true
2316    }
2317    pub unsafe fn m5u_speaker_is_playing(_channel: c_int) -> bool {
2318        false
2319    }
2320    pub unsafe fn m5u_speaker_playing_channels() -> usize {
2321        0
2322    }
2323    pub unsafe fn m5u_speaker_channel_playing_state(_channel: c_int) -> usize {
2324        0
2325    }
2326    pub unsafe fn m5u_speaker_stop(_channel: c_int) {}
2327    pub unsafe fn m5u_speaker_get_channel_volume(_channel: c_int) -> u8 {
2328        255
2329    }
2330    pub unsafe fn m5u_speaker_set_channel_volume(_channel: c_int, _volume: u8) {}
2331    pub unsafe fn m5u_speaker_set_all_channel_volume(_volume: u8) {}
2332
2333    pub unsafe fn m5u_imu_is_enabled() -> bool {
2334        true
2335    }
2336    pub unsafe fn m5u_imu_get_type() -> c_int {
2337        0
2338    }
2339    pub unsafe fn m5u_imu_update() -> bool {
2340        true
2341    }
2342    pub unsafe fn m5u_imu_update_mask() -> c_int {
2343        0
2344    }
2345    pub unsafe fn m5u_imu_sleep() -> bool {
2346        true
2347    }
2348    pub unsafe fn m5u_imu_set_clock(_freq: u32) {}
2349    pub unsafe fn m5u_imu_set_axis_order(_axis0: c_int, _axis1: c_int, _axis2: c_int) -> bool {
2350        true
2351    }
2352    pub unsafe fn m5u_imu_set_axis_order_right_handed(_axis0: c_int, _axis1: c_int) -> bool {
2353        true
2354    }
2355    pub unsafe fn m5u_imu_set_axis_order_left_handed(_axis0: c_int, _axis1: c_int) -> bool {
2356        true
2357    }
2358    pub unsafe fn m5u_imu_set_int_pin_active_logic(_level: bool) -> bool {
2359        true
2360    }
2361    pub unsafe fn m5u_imu_load_offset_from_nvs() -> bool {
2362        false
2363    }
2364    pub unsafe fn m5u_imu_save_offset_to_nvs() -> bool {
2365        false
2366    }
2367    pub unsafe fn m5u_imu_get_offset_data(_index: c_int) -> c_float {
2368        0.0
2369    }
2370    pub unsafe fn m5u_imu_set_calibration(_x: c_float, _y: c_float, _z: c_float) {}
2371    pub unsafe fn m5u_imu_set_calibration_strength(_accel: u8, _gyro: u8, _mag: u8) {}
2372    pub unsafe fn m5u_imu_clear_offset_data() {}
2373    pub unsafe fn m5u_imu_set_offset_data(_index: usize, _value: i32) {}
2374    pub unsafe fn m5u_imu_get_offset_data_i32(_index: usize) -> i32 {
2375        0
2376    }
2377    pub unsafe fn m5u_imu_get_raw_data(_index: usize) -> i16 {
2378        0
2379    }
2380    pub unsafe fn m5u_imu_device_begin(_kind: c_int) -> c_int {
2381        0
2382    }
2383    pub unsafe fn m5u_imu_device_get_raw_data(_kind: c_int, _out: *mut m5u_imu_raw_data_t) -> bool {
2384        false
2385    }
2386    pub unsafe fn m5u_imu_device_get_convert_param(
2387        _kind: c_int,
2388        out: *mut m5u_imu_convert_param_t,
2389    ) -> bool {
2390        if !out.is_null() {
2391            *out = m5u_imu_convert_param_t::default();
2392            true
2393        } else {
2394            false
2395        }
2396    }
2397    pub unsafe fn m5u_imu_device_get_temp_adc(_kind: c_int, _adc: *mut i16) -> bool {
2398        false
2399    }
2400    pub unsafe fn m5u_imu_device_sleep(_kind: c_int) -> bool {
2401        false
2402    }
2403    pub unsafe fn m5u_imu_device_set_int_pin_active_logic(_kind: c_int, _level: bool) -> bool {
2404        false
2405    }
2406    pub unsafe fn m5u_imu_device_who_am_i(_kind: c_int) -> c_int {
2407        -1
2408    }
2409
2410    pub unsafe fn m5u_touch_get_detail(_index: c_int, out: *mut m5u_touch_detail_t) -> bool {
2411        if !out.is_null() {
2412            *out = m5u_touch_detail_t::default();
2413        }
2414        false
2415    }
2416    pub unsafe fn m5u_touch_is_enabled() -> bool {
2417        false
2418    }
2419    pub unsafe fn m5u_touch_set_hold_thresh(_ms: u16) {}
2420    pub unsafe fn m5u_touch_set_flick_thresh(_distance: u16) {}
2421    pub unsafe fn m5u_rtc_set_system_time_from_rtc() {}
2422    pub unsafe fn m5u_rtc_set_timer_irq(timer_msec: u32) -> u32 {
2423        timer_msec
2424    }
2425    pub unsafe fn m5u_rtc_set_alarm_irq_after_seconds(after_seconds: c_int) -> c_int {
2426        after_seconds
2427    }
2428    pub unsafe fn m5u_rtc_set_alarm_irq_datetime(datetime: *const m5u_rtc_datetime_t) -> c_int {
2429        if datetime.is_null() {
2430            -1
2431        } else {
2432            0
2433        }
2434    }
2435    pub unsafe fn m5u_rtc_set_alarm_irq_time(time: *const m5u_rtc_datetime_t) -> c_int {
2436        if time.is_null() {
2437            -1
2438        } else {
2439            0
2440        }
2441    }
2442    pub unsafe fn m5u_rtc_get_irq_status() -> bool {
2443        false
2444    }
2445    pub unsafe fn m5u_rtc_clear_irq() {}
2446    pub unsafe fn m5u_rtc_disable_irq() {}
2447
2448    pub unsafe fn m5u_power_axp192_begin() -> bool {
2449        false
2450    }
2451    pub unsafe fn m5u_power_axp192_get_battery_level() -> c_int {
2452        -1
2453    }
2454    pub unsafe fn m5u_power_axp192_set_battery_charge(_enable: bool) -> bool {
2455        false
2456    }
2457    pub unsafe fn m5u_power_axp192_set_charge_current(_max_ma: u16) -> bool {
2458        false
2459    }
2460    pub unsafe fn m5u_power_axp192_set_charge_voltage(_max_mv: u16) -> bool {
2461        false
2462    }
2463    pub unsafe fn m5u_power_axp192_is_charging() -> bool {
2464        false
2465    }
2466    pub unsafe fn m5u_power_axp192_set_dcdc(_channel: u8, _voltage_mv: c_int) -> bool {
2467        false
2468    }
2469    pub unsafe fn m5u_power_axp192_set_ldo(_channel: u8, _voltage_mv: c_int) -> bool {
2470        false
2471    }
2472    pub unsafe fn m5u_power_axp192_set_gpio(_gpio_num: u8, _state: bool) -> bool {
2473        false
2474    }
2475    pub unsafe fn m5u_power_axp192_power_off() -> bool {
2476        false
2477    }
2478    pub unsafe fn m5u_power_axp192_set_adc_state(_enable: bool) -> bool {
2479        false
2480    }
2481    pub unsafe fn m5u_power_axp192_set_adc_rate(_rate: u8) -> bool {
2482        false
2483    }
2484    pub unsafe fn m5u_power_axp192_set_exten(_enable: bool) -> bool {
2485        false
2486    }
2487    pub unsafe fn m5u_power_axp192_set_backup(_enable: bool) -> bool {
2488        false
2489    }
2490    pub unsafe fn m5u_power_axp192_is_acin() -> bool {
2491        false
2492    }
2493    pub unsafe fn m5u_power_axp192_is_vbus() -> bool {
2494        false
2495    }
2496    pub unsafe fn m5u_power_axp192_get_bat_state() -> bool {
2497        false
2498    }
2499    pub unsafe fn m5u_power_axp192_get_exten() -> bool {
2500        false
2501    }
2502    pub unsafe fn m5u_power_axp192_get_battery_voltage_v() -> c_float {
2503        0.0
2504    }
2505    pub unsafe fn m5u_power_axp192_get_battery_discharge_current_ma() -> c_float {
2506        0.0
2507    }
2508    pub unsafe fn m5u_power_axp192_get_battery_charge_current_ma() -> c_float {
2509        0.0
2510    }
2511    pub unsafe fn m5u_power_axp192_get_battery_power_mw() -> c_float {
2512        0.0
2513    }
2514    pub unsafe fn m5u_power_axp192_get_acin_voltage_v() -> c_float {
2515        0.0
2516    }
2517    pub unsafe fn m5u_power_axp192_get_acin_current_ma() -> c_float {
2518        0.0
2519    }
2520    pub unsafe fn m5u_power_axp192_get_vbus_voltage_v() -> c_float {
2521        0.0
2522    }
2523    pub unsafe fn m5u_power_axp192_get_vbus_current_ma() -> c_float {
2524        0.0
2525    }
2526    pub unsafe fn m5u_power_axp192_get_aps_voltage_v() -> c_float {
2527        0.0
2528    }
2529    pub unsafe fn m5u_power_axp192_get_internal_temperature_c() -> c_float {
2530        0.0
2531    }
2532    pub unsafe fn m5u_power_axp192_get_pek_press() -> u8 {
2533        0
2534    }
2535    pub unsafe fn m5u_power_aw32001_begin() -> bool {
2536        false
2537    }
2538    pub unsafe fn m5u_power_aw32001_set_battery_charge(_enable: bool) -> bool {
2539        false
2540    }
2541    pub unsafe fn m5u_power_aw32001_set_charge_current(_max_ma: u16) -> bool {
2542        false
2543    }
2544    pub unsafe fn m5u_power_aw32001_set_charge_voltage(_max_mv: u16) -> bool {
2545        false
2546    }
2547    pub unsafe fn m5u_power_aw32001_is_charging() -> bool {
2548        false
2549    }
2550    pub unsafe fn m5u_power_aw32001_get_charge_current() -> u16 {
2551        0
2552    }
2553    pub unsafe fn m5u_power_aw32001_get_charge_voltage() -> u16 {
2554        0
2555    }
2556    pub unsafe fn m5u_power_aw32001_get_charge_status() -> c_int {
2557        -1
2558    }
2559    pub unsafe fn m5u_power_bq27220_begin() -> bool {
2560        false
2561    }
2562    pub unsafe fn m5u_power_bq27220_get_current_ma() -> i16 {
2563        0
2564    }
2565    pub unsafe fn m5u_power_bq27220_get_voltage_mv() -> i16 {
2566        0
2567    }
2568    pub unsafe fn m5u_power_bq27220_get_current_a() -> c_float {
2569        0.0
2570    }
2571    pub unsafe fn m5u_power_bq27220_get_voltage_v() -> c_float {
2572        0.0
2573    }
2574    pub unsafe fn m5u_power_ina226_begin() -> bool {
2575        false
2576    }
2577    pub unsafe fn m5u_power_ina226_config(_config: *const m5u_power_ina226_config_t) -> bool {
2578        false
2579    }
2580    pub unsafe fn m5u_power_ina226_get_bus_voltage_v() -> c_float {
2581        0.0
2582    }
2583    pub unsafe fn m5u_power_ina226_get_shunt_voltage_v() -> c_float {
2584        0.0
2585    }
2586    pub unsafe fn m5u_power_ina226_get_shunt_current_a() -> c_float {
2587        0.0
2588    }
2589    pub unsafe fn m5u_power_ina226_get_power_w() -> c_float {
2590        0.0
2591    }
2592    pub unsafe fn m5u_power_ina3221_begin(_index: usize) -> bool {
2593        false
2594    }
2595    pub unsafe fn m5u_power_ina3221_get_bus_voltage_v(_index: usize, _channel: u8) -> c_float {
2596        0.0
2597    }
2598    pub unsafe fn m5u_power_ina3221_get_shunt_voltage_v(_index: usize, _channel: u8) -> c_float {
2599        0.0
2600    }
2601    pub unsafe fn m5u_power_ina3221_get_current_a(_index: usize, _channel: u8) -> c_float {
2602        0.0
2603    }
2604    pub unsafe fn m5u_power_ina3221_get_bus_voltage_mv(_index: usize, _channel: u8) -> i32 {
2605        0
2606    }
2607    pub unsafe fn m5u_power_ina3221_get_shunt_voltage_mv(_index: usize, _channel: u8) -> i32 {
2608        0
2609    }
2610    pub unsafe fn m5u_power_ina3221_set_shunt_res(_index: usize, _channel: u8, _res: u32) -> bool {
2611        false
2612    }
2613    pub unsafe fn m5u_power_ip5306_begin() -> bool {
2614        false
2615    }
2616    pub unsafe fn m5u_power_ip5306_get_battery_level() -> c_int {
2617        -1
2618    }
2619    pub unsafe fn m5u_power_ip5306_set_battery_charge(_enable: bool) -> bool {
2620        false
2621    }
2622    pub unsafe fn m5u_power_ip5306_set_charge_current(_max_ma: u16) -> bool {
2623        false
2624    }
2625    pub unsafe fn m5u_power_ip5306_set_charge_voltage(_max_mv: u16) -> bool {
2626        false
2627    }
2628    pub unsafe fn m5u_power_ip5306_is_charging() -> bool {
2629        false
2630    }
2631    pub unsafe fn m5u_power_ip5306_set_power_boost_keep_on(_enable: bool) -> bool {
2632        false
2633    }
2634    pub unsafe fn m5u_power_py32pmic_begin() -> bool {
2635        false
2636    }
2637    pub unsafe fn m5u_power_py32pmic_set_ext_output(_enable: bool) -> bool {
2638        false
2639    }
2640    pub unsafe fn m5u_power_py32pmic_set_battery_charge(_enable: bool) -> bool {
2641        false
2642    }
2643    pub unsafe fn m5u_power_py32pmic_set_charge_current(_max_ma: u16) -> bool {
2644        false
2645    }
2646    pub unsafe fn m5u_power_py32pmic_set_charge_voltage(_max_mv: u16) -> bool {
2647        false
2648    }
2649    pub unsafe fn m5u_power_py32pmic_is_charging() -> bool {
2650        false
2651    }
2652    pub unsafe fn m5u_power_py32pmic_get_charge_current() -> u16 {
2653        0
2654    }
2655    pub unsafe fn m5u_power_py32pmic_get_charge_voltage() -> u16 {
2656        0
2657    }
2658    pub unsafe fn m5u_power_py32pmic_get_pek_press() -> u8 {
2659        0
2660    }
2661    pub unsafe fn m5u_power_py32pmic_power_off() -> bool {
2662        false
2663    }
2664    pub unsafe fn m5u_power_axp2101_begin() -> bool {
2665        false
2666    }
2667    pub unsafe fn m5u_power_axp2101_get_battery_level() -> c_int {
2668        -1
2669    }
2670    pub unsafe fn m5u_power_axp2101_set_battery_charge(_enable: bool) -> bool {
2671        false
2672    }
2673    pub unsafe fn m5u_power_axp2101_set_pre_charge_current(_max_ma: u16) -> bool {
2674        false
2675    }
2676    pub unsafe fn m5u_power_axp2101_set_charge_current(_max_ma: u16) -> bool {
2677        false
2678    }
2679    pub unsafe fn m5u_power_axp2101_set_charge_voltage(_max_mv: u16) -> bool {
2680        false
2681    }
2682    pub unsafe fn m5u_power_axp2101_get_charge_status() -> c_int {
2683        -2
2684    }
2685    pub unsafe fn m5u_power_axp2101_is_charging() -> bool {
2686        false
2687    }
2688    pub unsafe fn m5u_power_axp2101_set_ldo(
2689        _kind: c_int,
2690        _channel: c_int,
2691        _voltage_mv: c_int,
2692    ) -> bool {
2693        false
2694    }
2695    pub unsafe fn m5u_power_axp2101_get_ldo_enabled(_kind: c_int, _channel: c_int) -> bool {
2696        false
2697    }
2698    pub unsafe fn m5u_power_axp2101_power_off() -> bool {
2699        false
2700    }
2701    pub unsafe fn m5u_power_axp2101_set_adc_state(_enable: bool) -> bool {
2702        false
2703    }
2704    pub unsafe fn m5u_power_axp2101_set_adc_rate(_rate: u8) -> bool {
2705        false
2706    }
2707    pub unsafe fn m5u_power_axp2101_set_backup(_enable: bool) -> bool {
2708        false
2709    }
2710    pub unsafe fn m5u_power_axp2101_is_acin() -> bool {
2711        false
2712    }
2713    pub unsafe fn m5u_power_axp2101_is_vbus() -> bool {
2714        false
2715    }
2716    pub unsafe fn m5u_power_axp2101_get_bat_state() -> bool {
2717        false
2718    }
2719    pub unsafe fn m5u_power_axp2101_get_battery_voltage_v() -> c_float {
2720        0.0
2721    }
2722    pub unsafe fn m5u_power_axp2101_get_battery_discharge_current_ma() -> c_float {
2723        0.0
2724    }
2725    pub unsafe fn m5u_power_axp2101_get_battery_charge_current_ma() -> c_float {
2726        0.0
2727    }
2728    pub unsafe fn m5u_power_axp2101_get_battery_power_mw() -> c_float {
2729        0.0
2730    }
2731    pub unsafe fn m5u_power_axp2101_get_acin_voltage_v() -> c_float {
2732        0.0
2733    }
2734    pub unsafe fn m5u_power_axp2101_get_acin_current_ma() -> c_float {
2735        0.0
2736    }
2737    pub unsafe fn m5u_power_axp2101_get_vbus_voltage_v() -> c_float {
2738        0.0
2739    }
2740    pub unsafe fn m5u_power_axp2101_get_vbus_current_ma() -> c_float {
2741        0.0
2742    }
2743    pub unsafe fn m5u_power_axp2101_get_ts_voltage_v() -> c_float {
2744        0.0
2745    }
2746    pub unsafe fn m5u_power_axp2101_get_aps_voltage_v() -> c_float {
2747        0.0
2748    }
2749    pub unsafe fn m5u_power_axp2101_get_internal_temperature_c() -> c_float {
2750        0.0
2751    }
2752    pub unsafe fn m5u_power_axp2101_get_pek_press() -> u8 {
2753        0
2754    }
2755    pub unsafe fn m5u_power_axp2101_disable_irq(_mask: u64) -> bool {
2756        false
2757    }
2758    pub unsafe fn m5u_power_axp2101_enable_irq(_mask: u64) -> bool {
2759        false
2760    }
2761    pub unsafe fn m5u_power_axp2101_clear_irq_statuses() -> bool {
2762        false
2763    }
2764    pub unsafe fn m5u_power_axp2101_get_irq_statuses() -> u64 {
2765        0
2766    }
2767    pub unsafe fn m5u_power_axp2101_is_bat_charger_under_temperature_irq() -> bool {
2768        false
2769    }
2770    pub unsafe fn m5u_power_axp2101_is_bat_charger_over_temperature_irq() -> bool {
2771        false
2772    }
2773    pub unsafe fn m5u_power_axp2101_is_vbus_insert_irq() -> bool {
2774        false
2775    }
2776    pub unsafe fn m5u_power_axp2101_is_vbus_remove_irq() -> bool {
2777        false
2778    }
2779
2780    pub unsafe fn m5u_led_begin() -> bool {
2781        false
2782    }
2783    pub unsafe fn m5u_led_display() {}
2784    pub unsafe fn m5u_led_set_auto_display(_enable: bool) {}
2785    pub unsafe fn m5u_led_count() -> usize {
2786        0
2787    }
2788    pub unsafe fn m5u_led_set_brightness(_brightness: u8) {}
2789    pub unsafe fn m5u_led_set_color_rgb(_index: usize, _r: u8, _g: u8, _b: u8) {}
2790    pub unsafe fn m5u_led_set_all_color_rgb(_r: u8, _g: u8, _b: u8) {}
2791    pub unsafe fn m5u_led_set_colors_rgb(
2792        _colors: *const m5u_led_color_t,
2793        _index: usize,
2794        _length: usize,
2795    ) {
2796    }
2797    pub unsafe fn m5u_led_get_type(_index: usize) -> c_int {
2798        0
2799    }
2800    pub unsafe fn m5u_led_is_enabled() -> bool {
2801        false
2802    }
2803    pub unsafe fn m5u_led_power_hub_begin() -> bool {
2804        false
2805    }
2806    pub unsafe fn m5u_led_power_hub_count() -> usize {
2807        0
2808    }
2809    pub unsafe fn m5u_led_power_hub_set_brightness(_brightness: u8) {}
2810    pub unsafe fn m5u_led_power_hub_set_color_rgb(_index: usize, _r: u8, _g: u8, _b: u8) {}
2811    pub unsafe fn m5u_led_power_hub_set_colors_rgb(
2812        _colors: *const m5u_led_color_t,
2813        _index: usize,
2814        _length: usize,
2815    ) {
2816    }
2817    pub unsafe fn m5u_led_power_hub_display() {}
2818    pub unsafe fn m5u_led_power_hub_get_type(_index: usize) -> c_int {
2819        0
2820    }
2821    pub unsafe fn m5u_led_strip_set_config(_config: *const m5u_led_strip_config_t) -> bool {
2822        false
2823    }
2824    pub unsafe fn m5u_led_strip_set_rmt_bus_config(
2825        _config: *const m5u_led_strip_rmt_config_t,
2826    ) -> bool {
2827        false
2828    }
2829    pub unsafe fn m5u_led_strip_begin() -> bool {
2830        false
2831    }
2832    pub unsafe fn m5u_led_strip_count() -> usize {
2833        0
2834    }
2835    pub unsafe fn m5u_led_strip_set_brightness(_brightness: u8) {}
2836    pub unsafe fn m5u_led_strip_set_color_rgb(_index: usize, _r: u8, _g: u8, _b: u8) {}
2837    pub unsafe fn m5u_led_strip_set_colors_rgb(
2838        _colors: *const m5u_led_color_t,
2839        _index: usize,
2840        _length: usize,
2841    ) {
2842    }
2843    pub unsafe fn m5u_led_strip_display() {}
2844    pub unsafe fn m5u_led_strip_get_type(_index: usize) -> c_int {
2845        0
2846    }
2847
2848    pub unsafe fn m5u_log_print(_text: *const c_char) {}
2849    pub unsafe fn m5u_log_println(_text: *const c_char) {}
2850    pub unsafe fn m5u_log_println_empty() {}
2851    pub unsafe fn m5u_log_level(_level: c_int, _text: *const c_char) {}
2852    pub unsafe fn m5u_log_dump(_addr: *const c_void, _len: u32, _level: c_int) {}
2853    pub unsafe fn m5u_log_path_to_file_name(path: *const c_char) -> *const c_char {
2854        if path.is_null() {
2855            return path;
2856        }
2857        let mut current = path;
2858        let mut file = path;
2859        while *current != 0 {
2860            if *current == b'/' as c_char || *current == b'\\' as c_char {
2861                file = current.add(1);
2862            }
2863            current = current.add(1);
2864        }
2865        file
2866    }
2867    pub unsafe fn m5u_log_set_callback(
2868        _callback: m5u_log_callback_t,
2869        _user_data: *mut c_void,
2870    ) -> bool {
2871        true
2872    }
2873    pub unsafe fn m5u_log_set_enable_color(target: c_int, _enable: bool) -> bool {
2874        (0..=2).contains(&target)
2875    }
2876    pub unsafe fn m5u_log_get_enable_color(target: c_int) -> bool {
2877        (0..=2).contains(&target)
2878    }
2879    pub unsafe fn m5u_log_set_level(target: c_int, level: c_int) -> bool {
2880        (0..=2).contains(&target) && (0..=5).contains(&level)
2881    }
2882    pub unsafe fn m5u_log_get_level(target: c_int) -> c_int {
2883        if (0..=2).contains(&target) {
2884            3
2885        } else {
2886            -1
2887        }
2888    }
2889    pub unsafe fn m5u_log_set_suffix(target: c_int, suffix: *const c_char) -> bool {
2890        (0..=2).contains(&target) && !suffix.is_null()
2891    }
2892    pub unsafe fn m5u_sd_begin() -> bool {
2893        false
2894    }
2895    pub unsafe fn m5u_sd_begin_spi(_config: *const m5u_sd_spi_config_t) -> bool {
2896        false
2897    }
2898    pub unsafe fn m5u_sd_is_mounted() -> bool {
2899        false
2900    }
2901    pub unsafe fn m5u_sd_end() {}
2902}
2903
2904#[cfg(not(target_os = "espidf"))]
2905pub use host_stubs::*;