Skip to content

Commit

Permalink
update to eh1 (#4)
Browse files Browse the repository at this point in the history
* update to eh1

* Update .github/workflows/build.yml

Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>

* annotate changes in CHANGELOG.md

---------

Co-authored-by: Diego Barrios Romero <eldruin@gmail.com>
  • Loading branch information
romancardenas and eldruin authored Nov 11, 2024
1 parent 0be5142 commit 45309db
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 33 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, 1.31.0]
rust: [stable, 1.60.0]
TARGET:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.52.1]
rust: [1.60.0]
TARGET:
- x86_64-unknown-linux-gnu

Expand Down Expand Up @@ -139,10 +139,11 @@ jobs:
toolchain: stable
override: true

- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin

- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
args: '--out Lcov -- --test-threads 1'
run: cargo tarpaulin --all --out Lcov -- --test-threads 1

- name: upload to Coveralls
uses: coverallsapp/github-action@master
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]

### Changed
- MSRV bumped to 1.60 (required by `embedded-hal` 1.0.0)
- [breaking-change] Update `embedded-hal` to version 1.0.0
- [breaking-change] Renamed `mode::MultiLED` mode marker `mode::MultiLed` due to naming conventions.

### Fixed
Expand Down
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "max3010x"
version = "0.1.0"
edition = "2021"
version = "0.2.0"
authors = ["Diego Barrios Romero <eldruin@gmail.com>"]
repository = "https://github.com/eldruin/max3010x-rs"
license = "MIT OR Apache-2.0"
Expand All @@ -12,12 +13,12 @@ homepage = "https://github.com/eldruin/max3010x-rs"
documentation = "https://docs.rs/max3010x"

[dependencies]
embedded-hal = "0.2.5"
embedded-hal = "1.0.0"
nb = "1"

[dev-dependencies]
linux-embedded-hal = "0.3"
embedded-hal-mock = "0.7"
linux-embedded-hal = "0.4"
embedded-hal-mock = "0.11.1"

[profile.release]
lto = true
4 changes: 0 additions & 4 deletions examples/linux.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate embedded_hal;
extern crate linux_embedded_hal;
extern crate max3010x;

use linux_embedded_hal::I2cdev;
use max3010x::{Led, Max3010x, SampleAveraging};

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/config/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
marker, private, AdcRange, BitFlags as BF, Config, Error, FifoAlmostFullLevelInterrupt,
LedPulseWidth, Max3010x, Register as Reg, SampleAveraging, SamplingRate,
};
use hal::blocking::i2c;
use hal::i2c;

impl FifoAlmostFullLevelInterrupt {
fn get_register_value(self) -> u8 {
Expand Down Expand Up @@ -64,7 +64,7 @@ macro_rules! high_low_flag_impl {

impl<I2C, E, IC, MODE> Max3010x<I2C, IC, MODE>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
{
/// Resets the FIFO read and write pointers and overflow counter to 0.
pub fn clear_fifo(&mut self) -> Result<(), Error<E>> {
Expand Down Expand Up @@ -224,7 +224,7 @@ impl ValidateSrPw for marker::mode::MultiLed {

impl<I2C, E, IC, MODE> Max3010x<I2C, IC, MODE>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
MODE: ValidateSrPw,
{
/// Configure the LED pulse width.
Expand Down Expand Up @@ -278,7 +278,7 @@ where

impl<I2C, E, IC> Max3010x<I2C, IC, marker::mode::Oximeter>
where
I2C: i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
{
/// Configure analog-to-digital converter range. (Only available in Oximeter mode)
pub fn set_adc_range(&mut self, range: AdcRange) -> Result<(), Error<E>> {
Expand Down Expand Up @@ -307,7 +307,7 @@ impl HasDataReadyInterrupt for marker::mode::Oximeter {}

impl<I2C, E, IC, MODE> Max3010x<I2C, IC, MODE>
where
I2C: i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
MODE: HasDataReadyInterrupt,
{
high_low_flag_impl!(
Expand Down
6 changes: 3 additions & 3 deletions src/config/max30102.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! Max30102-specific configuration methods.
use crate::{marker, Error, Led, Max3010x, Register as Reg, TimeSlot};
use core::marker::PhantomData;
use hal::blocking::i2c;
use hal::i2c;

impl<I2C, E, MODE> Max3010x<I2C, marker::ic::Max30102, MODE>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
{
/// Change into heart-rate mode.
///
Expand Down Expand Up @@ -101,7 +101,7 @@ impl TimeSlot {

impl<I2C, E> Max3010x<I2C, marker::ic::Max30102, marker::mode::MultiLed>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
{
/// Configure LED time slots in Multi-LED mode
///
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
#![no_std]

extern crate embedded_hal as hal;
use hal::blocking::i2c;
use hal::i2c;
extern crate nb;
use core::marker::PhantomData;

Expand Down Expand Up @@ -377,7 +377,7 @@ pub struct Max3010x<I2C, IC, MODE> {

impl<I2C, E> Max3010x<I2C, marker::ic::Max30102, marker::mode::None>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
{
/// Create new instance of the MAX3010x device.
pub fn new_max30102(i2c: I2C) -> Self {
Expand All @@ -397,7 +397,7 @@ where

impl<I2C, E, IC, MODE> Max3010x<I2C, IC, MODE>
where
I2C: i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
{
/// Destroy driver instance, return I²C bus instance.
pub fn destroy(self) -> I2C {
Expand Down
6 changes: 3 additions & 3 deletions src/reading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{
marker, private, BitFlags, Error, InterruptStatus, LedPulseWidth, Max3010x, Register,
SamplingRate, DEVICE_ADDRESS,
};
use hal::blocking::i2c;
use hal::i2c;

#[doc(hidden)]
pub trait ChannelCount<IC, MODE>: private::Sealed {
Expand All @@ -25,7 +25,7 @@ impl ChannelCount<marker::ic::Max30102, marker::mode::MultiLed> for marker::mode

impl<I2C, E, IC, MODE> Max3010x<I2C, IC, MODE>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
MODE: ChannelCount<IC, MODE>,
{
/// Reads samples from FIFO.
Expand Down Expand Up @@ -125,7 +125,7 @@ fn convert_sampling_rate(spo2_config: u8) -> SamplingRate {

impl<I2C, E, IC, MODE> Max3010x<I2C, IC, MODE>
where
I2C: i2c::WriteRead<Error = E> + i2c::Write<Error = E>,
I2C: i2c::I2c<Error = E>,
{
/// Get number of samples available for reading from FIFO.
pub fn get_available_sample_count(&mut self) -> Result<u8, Error<E>> {
Expand Down
2 changes: 1 addition & 1 deletion tests/base/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use hal::i2c::{Mock as I2cMock, Transaction as I2cTrans};
use hal::eh1::i2c::{Mock as I2cMock, Transaction as I2cTrans};
use max3010x::{marker, Max3010x};

pub const DEV_ADDR: u8 = 0b101_0111;
Expand Down
2 changes: 1 addition & 1 deletion tests/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate embedded_hal_mock as hal;
use hal::i2c::Transaction as I2cTrans;
use hal::eh1::i2c::Transaction as I2cTrans;
extern crate max3010x;
extern crate nb;
use max3010x::{FifoAlmostFullLevelInterrupt, Led, LedPulseWidth, SampleAveraging};
Expand Down
2 changes: 1 addition & 1 deletion tests/heart_rate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate embedded_hal_mock as hal;
use hal::i2c::Transaction as I2cTrans;
use hal::eh1::i2c::Transaction as I2cTrans;
extern crate max3010x;
extern crate nb;
use max3010x::{LedPulseWidth as LedPw, SamplingRate as SR};
Expand Down
2 changes: 1 addition & 1 deletion tests/interrupts.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate embedded_hal_mock as hal;
use hal::i2c::Transaction as I2cTrans;
use hal::eh1::i2c::Transaction as I2cTrans;
extern crate max3010x;
extern crate nb;
use max3010x::InterruptStatus;
Expand Down
2 changes: 1 addition & 1 deletion tests/multiled.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate embedded_hal_mock as hal;
use hal::i2c::Transaction as I2cTrans;
use hal::eh1::i2c::Transaction as I2cTrans;
extern crate max3010x;
extern crate nb;
use max3010x::{LedPulseWidth as LedPw, SamplingRate as SR, TimeSlot};
Expand Down
2 changes: 1 addition & 1 deletion tests/oximeter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate embedded_hal_mock as hal;
use hal::i2c::Transaction as I2cTrans;
use hal::eh1::i2c::Transaction as I2cTrans;
extern crate max3010x;
use max3010x::{AdcRange, LedPulseWidth as LedPw, SamplingRate as SR};
mod base;
Expand Down

0 comments on commit 45309db

Please sign in to comment.