use crate::{macros::wrap_free, mem::heap_move_nonnull}; use servicepoint::{ClearCommand, FadeOutCommand, HardResetCommand}; use std::ptr::NonNull; /// Set all pixels to the off state. /// /// Does not affect brightness. /// /// Returns: a new [ClearCommand] instance. #[no_mangle] pub unsafe extern "C" fn sp_cmd_clear_new() -> NonNull { heap_move_nonnull(ClearCommand) } wrap_free!(ClearCommand, sp_cmd_clear); /// Kills the udp daemon on the display, which usually results in a restart. /// /// Please do not send this in your normal program flow. /// /// Returns: a new [HardResetCommand] instance. #[no_mangle] pub unsafe extern "C" fn sp_cmd_hard_reset_new() -> NonNull { heap_move_nonnull(HardResetCommand) } wrap_free!(HardResetCommand, sp_cmd_hard_reset); /// A yet-to-be-tested command. /// /// Returns: a new [FadeOutCommand] instance. #[no_mangle] pub unsafe extern "C" fn sp_cmd_fade_out_new() -> NonNull { heap_move_nonnull(FadeOutCommand) } wrap_free!(FadeOutCommand, sp_cmd_fade_out);