#![allow(
unsafe_code,
reason = "unsafe impl Sync is sound: single-threaded Embassy executor, no concurrent access"
)]
use crate::Error;
#[cfg(target_os = "none")]
use crate::flash_block::FlashBlockEsp;
use device_envoy_core::__impl_wifi_auto_fields;
use device_envoy_core::wifi_auto::{FormData, HtmlBuffer, WifiAutoField};
__impl_wifi_auto_fields!(
flash_block = FlashBlockEsp,
error = Error,
wifi_auto_field = WifiAutoField,
form_data = FormData<'_>,
html_buffer = HtmlBuffer,
flash_cfg = target_os = "none"
);
#[cfg(target_os = "none")]
impl TimezoneField {
pub fn new(
timezone_field_static: &'static TimezoneFieldStatic,
timezone_flash_block: FlashBlockEsp,
) -> &'static Self {
Self::new_with_flash(timezone_field_static, timezone_flash_block)
}
}
#[cfg(not(target_os = "none"))]
impl TimezoneField {
pub fn new(timezone_field_static: &'static TimezoneFieldStatic) -> &'static Self {
Self::new_in_memory(timezone_field_static)
}
}
#[cfg(target_os = "none")]
impl<const N: usize> TextField<N> {
pub fn new(
text_field_static: &'static TextFieldStatic<N>,
text_flash_block: FlashBlockEsp,
field_name: &'static str,
label: &'static str,
default_value: &'static str,
) -> &'static Self {
Self::new_with_flash(
text_field_static,
text_flash_block,
field_name,
label,
default_value,
)
}
}
#[cfg(not(target_os = "none"))]
impl<const N: usize> TextField<N> {
pub fn new(
text_field_static: &'static TextFieldStatic<N>,
field_name: &'static str,
label: &'static str,
default_value: &'static str,
) -> &'static Self {
Self::new_in_memory(text_field_static, field_name, label, default_value)
}
}