Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions messages/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ pub mod version {
/// Addition to HwError: I2cSclStretchTimeout
pub const V5: u8 = 5;

pub const CURRENT: u8 = V5;
/// Addition to HwError: I2cTransactionTimeout
pub const V6: u8 = 6;

pub const CURRENT: u8 = V6;
pub const MIN: u8 = V1;
}
pub mod outer {
Expand Down Expand Up @@ -200,6 +203,16 @@ pub enum HwError {
/// CMIS 5.0 section B.2.7.3 but referred to as tRD.
#[cfg_attr(any(test, feature = "std"), error("The module stretched SCL too long"))]
I2cSclStretchTimeout,

/// An I2C transaction has gone on for too long.
///
/// While neither SFF-8636 or CMIS give guidance for transaction timeouts,
/// we are opting to use the SMBus t_timeout,min of 25ms to timeout.
#[cfg_attr(
any(test, feature = "std"),
error("The I2C transaction to the module timed out")
)]
I2cTransactionTimeout,
}

/// Deserialize the [`HwError`]s from a packet buffer that are expected, given
Expand Down Expand Up @@ -1069,7 +1082,7 @@ mod test {
#[test]
fn test_hardware_error_encoding_unchanged() {
let mut buf = [0u8; HwError::MAX_SIZE];
const TEST_DATA: [HwError; 13] = [
const TEST_DATA: [HwError; 14] = [
HwError::I2cError,
HwError::InvalidModuleIndex,
HwError::FpgaError,
Expand All @@ -1083,6 +1096,7 @@ mod test {
HwError::I2cAddressNack,
HwError::I2cByteNack,
HwError::I2cSclStretchTimeout,
HwError::I2cTransactionTimeout,
];

for (variant_id, variant) in TEST_DATA.iter().enumerate() {
Expand Down