servicepoint-binding-c/src/commands/cc_only_commands.rs
2025-06-16 21:45:27 +02:00

38 lines
1 KiB
Rust

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<ClearCommand> {
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<HardResetCommand> {
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<FadeOutCommand> {
heap_move_nonnull(FadeOutCommand)
}
wrap_free!(FadeOutCommand, sp_cmd_fade_out);