Skip to content

Commit 8178455

Browse files
authored
Docs for more packets. (#9)
1 parent bbb107d commit 8178455

File tree

5 files changed

+36
-6
lines changed

5 files changed

+36
-6
lines changed

src/packets/flight_mode.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ use crate::packets::PacketType;
33
use crate::CrsfParsingError;
44
use heapless::String;
55

6+
/// Represents a Flight Mode packet.
7+
///
8+
/// Contains the flight mode as a null-terminated string.
69
#[derive(Clone, Debug, PartialEq)]
710
pub struct FlightMode {
11+
/// The flight mode string.
812
pub flight_mode: String<63>,
913
}
1014

src/packets/gps.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@ use crate::packets::CrsfPacket;
22
use crate::packets::PacketType;
33
use crate::CrsfParsingError;
44

5+
/// Represents a GPS packet.
56
#[derive(Clone, Debug, PartialEq)]
67
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
78
pub struct Gps {
8-
pub latitude: i32, // degree / 10`000`000
9-
pub longitude: i32, // degree / 10`000`000
10-
pub groundspeed: u16, // km/h / 100
11-
pub heading: u16, // degree / 100
12-
pub altitude: u16, // meter - 1000m offset
13-
pub satellites: u8, // # of sats in view
9+
/// Latitude in degrees * 10^7.
10+
pub latitude: i32,
11+
/// Longitude in degrees * 10^7.
12+
pub longitude: i32,
13+
/// Groundspeed in 0.01 km/h units.
14+
pub groundspeed: u16,
15+
/// Heading in 0.01 degree units.
16+
pub heading: u16,
17+
/// Altitude with 1000m offset.
18+
pub altitude: u16,
19+
/// Number of satellites in view.
20+
pub satellites: u8,
1421
}
1522

1623
impl CrsfPacket for Gps {

src/packets/gps_extended.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,33 @@ use crate::packets::CrsfPacket;
22
use crate::packets::PacketType;
33
use crate::CrsfParsingError;
44

5+
/// Represents an Extended GPS packet.
56
#[derive(Clone, Debug, PartialEq)]
67
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
78
pub struct GpsExtended {
9+
/// Current GPS fix quality.
810
pub fix_type: u8,
11+
/// Northward speed (north = positive) in cm/s.
912
pub n_speed: i16,
13+
/// Eastward speed (east = positive) in cm/s.
1014
pub e_speed: i16,
15+
/// Vertical speed (up = positive) in cm/s.
1116
pub v_speed: i16,
17+
/// Horizontal speed accuracy in cm/s.
1218
pub h_speed_acc: i16,
19+
/// Heading accuracy in 0.1 degrees.
1320
pub track_acc: i16,
21+
/// Height above GPS Ellipsoid (not MSL) in meters.
1422
pub alt_ellipsoid: i16,
23+
/// Horizontal accuracy in cm.
1524
pub h_acc: i16,
25+
/// Vertical accuracy in cm.
1626
pub v_acc: i16,
27+
/// Reserved for future use.
1728
pub reserved: u8,
29+
/// Horizontal dilution of precision in 0.1 units.
1830
pub h_dop: u8,
31+
/// Vertical dilution of precision in 0.1 units.
1932
pub v_dop: u8,
2033
}
2134

src/packets/gps_time.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ use crate::packets::CrsfPacket;
22
use crate::packets::PacketType;
33
use crate::CrsfParsingError;
44

5+
/// Represents a GPS Time packet.
6+
///
7+
/// This frame is needed for synchronization with a GPS time pulse.
8+
/// The maximum offset of time is +/-10ms.
59
#[derive(Clone, Debug, PartialEq)]
610
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
711
pub struct GpsTime {

src/packets/heartbeat.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ use crate::packets::CrsfPacket;
22
use crate::packets::PacketType;
33
use crate::CrsfParsingError;
44

5+
/// Represents a Heartbeat packet.
56
#[derive(Clone, Debug, PartialEq)]
67
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
78
pub struct Heartbeat {
9+
/// Origin device address.
810
pub origin_address: i16,
911
}
1012

0 commit comments

Comments
 (0)