servicepoint-binding-c/src/commands/cc_only_commands.rs
2025-06-18 20:30:55 +02:00

44 lines
1.1 KiB
Rust

use crate::{
macros::{wrap_free, wrap_functions},
mem::heap_move_nonnull,
};
use servicepoint::{ClearCommand, FadeOutCommand, HardResetCommand};
use std::ptr::NonNull;
wrap_functions!(sp_cmd_clear;
/// Set all pixels to the off state.
///
/// Does not affect brightness.
///
/// Returns: a new [ClearCommand] instance.
fn new() -> NonNull<ClearCommand> {
heap_move_nonnull(ClearCommand)
}
);
wrap_free!(sp_cmd_clear::ClearCommand);
wrap_functions!(sp_cmd_hard_reset;
/// 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.
fn new() -> NonNull<HardResetCommand> {
heap_move_nonnull(HardResetCommand)
}
);
wrap_free!(sp_cmd_hard_reset::HardResetCommand);
wrap_functions!(sp_cmd_fade_out;
/// A yet-to-be-tested command.
///
/// Returns: a new [FadeOutCommand] instance.
fn new() -> NonNull<FadeOutCommand> {
heap_move_nonnull(FadeOutCommand)
}
);
wrap_free!(sp_cmd_fade_out::FadeOutCommand);