ssp/enable/
command.rs

1use crate::{
2    impl_command_display, impl_command_ops, impl_default, impl_message_from_buf, impl_message_ops,
3    len, CommandOps, MessageOps, MessageType,
4};
5
6/// Enable - Command (0x0A)
7///
8/// Single byte command enables the unit. It will now respond to and execute commands.
9#[repr(C)]
10#[derive(Clone, Copy, Debug, PartialEq)]
11pub struct EnableCommand {
12    buf: [u8; len::ENABLE_COMMAND],
13}
14
15impl EnableCommand {
16    /// Creates a new [EnableCommand] message.
17    pub fn new() -> Self {
18        let mut msg = Self {
19            buf: [0u8; len::ENABLE_COMMAND],
20        };
21
22        msg.init();
23        msg.set_command(MessageType::Enable);
24
25        msg
26    }
27}
28
29impl_default!(EnableCommand);
30impl_command_display!(EnableCommand);
31impl_message_from_buf!(EnableCommand);
32impl_message_ops!(EnableCommand);
33impl_command_ops!(EnableCommand);