diff --git a/CHANGELOG.md b/CHANGELOG.md index 901035b..88b033e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.15.1] - 2023-05-13 +### Fixed +- Changed the `Error` and `ErrorKind` types from private to public. + ## [0.15.0] - 2023-04-22 ### Changed - Updated the alpha release of `embedded-hal` from `1.0.0-alpha.9` to `1.0.0-alpha.10`. @@ -135,7 +139,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.1.0] - 2020-09-12 - Initial release -[Unreleased]: https://github.com/ftdi-rs/ftdi-embedded-hal/compare/v0.15.0...HEAD +[Unreleased]: https://github.com/ftdi-rs/ftdi-embedded-hal/compare/v0.15.1...HEAD +[0.15.1]: https://github.com/ftdi-rs/ftdi-embedded-hal/compare/v0.15.0...v0.15.1 [0.15.0]: https://github.com/ftdi-rs/ftdi-embedded-hal/compare/v0.14.0...v0.15.0 [0.14.0]: https://github.com/ftdi-rs/ftdi-embedded-hal/compare/v0.13.0...v0.14.0 [0.13.0]: https://github.com/ftdi-rs/ftdi-embedded-hal/compare/v0.12.0...v0.13.0 diff --git a/Cargo.toml b/Cargo.toml index 7ffe9ba..7917c16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ftdi-embedded-hal" -version = "0.15.0" +version = "0.15.1" authors = ["Alex Martens "] description = "embedded-hal implementation for FTDI USB devices." keywords = ["ftdi", "usb", "io", "hal"] diff --git a/README.md b/README.md index 7ebfd68..edd8c14 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ FTDI device into the [embedded-hal] traits. ```toml [dependencies.ftdi-embedded-hal] -version = "0.15.0" +version = "0.15.1" features = ["libftd2xx", "libftd2xx-static"] ``` diff --git a/src/error.rs b/src/error.rs index c6e6441..9f706ef 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,39 +1,29 @@ use std::fmt; use std::io; -/// HAL error type combines 3 types of errors: -/// * internal HAL errors -/// * I/O errors -/// * FTDI drivers errors +/// Error type. #[derive(Debug)] pub enum Error { + /// ftdi-embedded-hal implementation specific error. Hal(ErrorKind), + /// IO error. Io(io::Error), + /// Backend specific error. Backend(E), } /// Internal HAL errors #[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[non_exhaustive] pub enum ErrorKind { - InvalidParams, - InvalidClock, - BusBusy, + /// No ACK from the I2C slave I2cNoAck, - GpioPinBusy, - GpioInvalidPin, - SpiModeNotSupported, } impl ErrorKind { fn as_str(&self) -> &str { match *self { - ErrorKind::InvalidParams => "Invalid input params", - ErrorKind::BusBusy => "Bus is busy", - ErrorKind::InvalidClock => "Clock is not valid", ErrorKind::I2cNoAck => "No ACK from slave", - ErrorKind::GpioPinBusy => "GPIO pin is already in use", - ErrorKind::GpioInvalidPin => "No such GPIO pin", - ErrorKind::SpiModeNotSupported => "Mode not supported", } } } diff --git a/src/lib.rs b/src/lib.rs index 05be332..58e0642 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ //! //! ```toml //! [dependencies.ftdi-embedded-hal] -//! version = "0.15.0" +//! version = "0.15.1" //! features = ["libftd2xx", "libftd2xx-static"] //! ``` //! @@ -158,7 +158,7 @@ mod gpio; mod i2c; mod spi; -use crate::error::Error; +pub use crate::error::{Error, ErrorKind}; pub use delay::Delay; pub use gpio::{InputPin, OutputPin}; pub use i2c::I2c;