Skip to content

Commit

Permalink
Add support for lpc55-hal 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Oct 25, 2024
1 parent 1e379a5 commit 52026cb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ SPDX-License-Identifier: CC0-1.0

# Changelog

## Unreleased

- Add support for `lpc55-hal` 0.4 behind a `lpc55-04` feature

## [v0.1.6][] (2025-08-13)

- Fix `ExportObject` for large keys (NIST-P521 and brainpoolp512) ([#16][])
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ heapless = "0.7"
hex-literal = "0.4.1"
iso7816 = "0.1.1"
lpc55-hal = { version = "0.3.0", optional = true }
lpc55-hal-04 = { package = "lpc55-hal", version = "0.4.0", optional = true }
nrf-hal-common = { version = "0.15.0", optional = true }
rand = { version = "0.8.5", optional = true, default-features = false }
serde = { version = "1.0.185", default-features = false, features = ["derive"], optional = true }
Expand All @@ -41,7 +42,9 @@ log-error = []
log-none = []

nrf = ["nrf-hal-common"]
lpc55 = ["lpc55-hal"]
lpc55 = ["lpc55-03"]
lpc55-03 = ["dep:lpc55-hal"]
lpc55-04 = ["dep:lpc55-hal-04"]

aes-session = ["aes", "cmac", "rand"]
serde_bytes = ["dep:serde_bytes"]
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ check: src/se05x/commands.rs
cargo c
cargo c --features builder
cargo c --features nrf,nrf-hal-common/52840 --target thumbv7em-none-eabihf
cargo c --features lpc55 --target thumbv8m.main-none-eabi
cargo c --features lpc55-03 --target thumbv8m.main-none-eabi
cargo c --features lpc55-04 --target thumbv8m.main-none-eabi


.PHONY: lint
Expand All @@ -28,7 +29,8 @@ lint: src/se05x/commands.rs verify-commands
cargo fmt --check
cargo clippy
cargo clippy --features nrf,nrf-hal-common/52840 --target thumbv7em-none-eabihf
cargo clippy --features lpc55 --target thumbv8m.main-none-eabi
cargo clippy --features lpc55-03 --target thumbv8m.main-none-eabi
cargo clippy --features lpc55-04 --target thumbv8m.main-none-eabi
cargo doc --features aes-session,builder,serde --no-deps

README.md: src/lib.rs Makefile
Expand Down
20 changes: 18 additions & 2 deletions src/t1/i2cimpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ mod nrf52832 {
}
}

#[cfg(feature = "lpc55")]
mod lpc55 {
#[cfg(feature = "lpc55-03")]
mod lpc55_03 {
use crate::t1::I2CErrorNack;

use lpc55_hal::drivers::i2c::Error;
Expand All @@ -32,3 +32,19 @@ mod lpc55 {
}
}
}

#[cfg(feature = "lpc55-04")]
mod lpc55_04 {
use crate::t1::I2CErrorNack;

use lpc55_hal_04::drivers::i2c::Error;

impl I2CErrorNack for Error {
fn is_address_nack(&self) -> bool {
matches!(self, Error::NackAddress)
}
fn is_data_nack(&self) -> bool {
matches!(self, Error::NackData)
}
}
}

0 comments on commit 52026cb

Please sign in to comment.