This repository was archived by the owner on Dec 15, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ extern crate ref_slice;
16
16
17
17
use clap:: { Arg , App , ArgMatches } ;
18
18
use heapless:: Vec as HVec ;
19
- use itm:: packet:: { self , Packet , UserData } ;
19
+ use itm:: packet:: { self , Packet , Instrumentation } ;
20
20
use log:: { LogRecord , LogLevelFilter } ;
21
21
use std:: fs:: File ;
22
22
use std:: io:: { Read , Write } ;
@@ -126,7 +126,7 @@ fn run() -> Result<()> {
126
126
match p {
127
127
Ok ( p) => {
128
128
match p. kind {
129
- packet:: Kind :: UserData ( ref ud) if ud. port == port => {
129
+ packet:: Kind :: Instrumentation ( ref ud) if ud. port == port => {
130
130
stdout. write_all ( & ud. payload ) ?;
131
131
}
132
132
_ => ( ) ,
@@ -181,8 +181,8 @@ fn read_packet(input: &mut Read) -> Result<Packet> {
181
181
let header = header[ 0 ] ;
182
182
match header & 0b111 {
183
183
0b001 |0b010 |0b011 => {
184
- // User data packet.
185
- let mut ud = UserData {
184
+ // Instrumentation packet.
185
+ let mut ud = Instrumentation {
186
186
payload : HVec :: new ( ) ,
187
187
port : header >> 3 ,
188
188
} ;
@@ -200,7 +200,7 @@ fn read_packet(input: &mut Read) -> Result<Packet> {
200
200
201
201
Ok ( Packet {
202
202
header : header,
203
- kind : packet:: Kind :: UserData ( ud) ,
203
+ kind : packet:: Kind :: Instrumentation ( ud) ,
204
204
} )
205
205
} ,
206
206
_ => {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use heapless::Vec as HVec;
4
4
5
5
pub const MAX_PAYLOAD_SIZE : usize = 4 ;
6
6
7
+ /// Represents a complete received packet.
7
8
pub struct Packet {
8
9
/// The header byte received for this packet.
9
10
pub header : u8 ,
@@ -12,16 +13,19 @@ pub struct Packet {
12
13
pub kind : Kind ,
13
14
}
14
15
16
+ /// The type of a packet.
15
17
pub enum Kind {
16
- UserData ( UserData ) ,
18
+ /// Data from a software application
19
+ Instrumentation ( Instrumentation ) ,
17
20
18
21
#[ doc( hidden) ]
19
22
/// External consumers shouldn't expect the public variants to
20
23
/// be complete: there are more variants to implement.
21
24
_NoExhaustiveMatch,
22
25
}
23
26
24
- pub struct UserData {
27
+ /// Contents of an Instrumentation packet, with data from a software application
28
+ pub struct Instrumentation {
25
29
/// Data in this packet.
26
30
pub payload : HVec < u8 , [ u8 ; MAX_PAYLOAD_SIZE ] > ,
27
31
You can’t perform that action at this time.
0 commit comments