skydroid-protocol 0.1.0

no_std, allocation-free Rust implementation of the SkydroidCameraFPV control protocol (#TP and AT+ command families). Build and parse camera control packets for embedded and OS projects.
Documentation
//! Secondary AT+ command family. Allocation-free.
pub enum At { LedOn, LedOff, Version, ResetNet, AnglePitch90, AnglePitch0, AnglePitch180, AngleCenter, AngleX0, AngleX1, AngleZ0, AngleZ1, SwitchD0, SwitchD1, SwitchE1, TempContinuity, VideoLow, VideoMedium, VideoHigh }
impl At {
    pub fn as_bytes(self) -> &'static [u8] {
        match self {
            At::LedOn => b"AT+LED -e1\r\n", At::LedOff => b"AT+LED -e0\r\n", At::Version => b"AT+VER -?\r\n", At::ResetNet => b"AT+RSTNET -f1\r\n",
            At::AnglePitch90 => b"AT+ANGLE -P90\r\n", At::AnglePitch0 => b"AT+ANGLE -P0\r\n", At::AnglePitch180 => b"AT+ANGLE -P180\r\n", At::AngleCenter => b"AT+ANGLE -C1\r\n",
            At::AngleX0 => b"AT+ANGLE -X0\r\n", At::AngleX1 => b"AT+ANGLE -X1\r\n", At::AngleZ0 => b"AT+ANGLE -Z0\r\n", At::AngleZ1 => b"AT+ANGLE -Z1\r\n",
            At::SwitchD0 => b"AT+SWITCH -d0\r\n", At::SwitchD1 => b"AT+SWITCH -d1\r\n", At::SwitchE1 => b"AT+SWITCH -e1\r\n", At::TempContinuity => b"AT+TEMP -c1\r\n",
            At::VideoLow => b"AT+VIDEO -m0 -p2 -f15 -b600 -e1 -g8\n", At::VideoMedium => b"AT+VIDEO -m0 -p2 -f15 -b900 -e1 -g8\n", At::VideoHigh => b"AT+VIDEO -m0 -p2 -f15 -b1200 -e1 -g8\n",
        }
    }
}
pub fn write_at(cmd: &[u8], out: &mut [u8]) -> Option<usize> { let n = cmd.len(); if out.len() < n { return None; } out[..n].copy_from_slice(cmd); Some(n) }
#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn at_bytes_are_static() { assert_eq!(At::LedOn.as_bytes(), b"AT+LED -e1\r\n"); assert_eq!(At::Version.as_bytes(), b"AT+VER -?\r\n"); }
}