1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
use serde::{Serialize, Deserialize};

/// JSON object for an encoder
///
/// ```json
/// {
///    "cpr": 0,
///    "inverted": false // Default: false
/// }
/// ```
///
/// Original source: [here](https://github.com/ewpratten/lib5k/blob/master/lib5k/src/main/java/io/github/frc5024/lib5k/config/types/JSONEncoder.java)
#[derive(Serialize, Deserialize)]
pub struct Encoder {

    /// Number of encoder counts (or pulses) per full rotation of the sensor
    pub cpr: i32,

    /// Weather the inputs are inverted
    pub inverted: Option<bool>
}