Skip to content

Commit

Permalink
pic32-hal v0.12.1 - bufix in GPIO, re-export SPI modes
Browse files Browse the repository at this point in the history
  • Loading branch information
kiffie committed Oct 23, 2024
1 parent 9b17484 commit b2b289f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pic32-hal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pic32-hal"
version = "0.12.0"
version = "0.12.1"
authors = ["Stephan <[email protected]>"]
edition = "2021"
description = "Hardware Abstraction Layer (HAL) for PIC32 microcontrollers"
Expand Down
8 changes: 4 additions & 4 deletions pic32-hal/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,22 @@ macro_rules! port {
impl<MODE> eh::InputPin for $PXi<Input<MODE>> {

fn is_high(&mut self) -> Result<bool, Self::Error> {
Ok(unsafe { (*$PORTX::ptr()).lat.read().bits() & (1 << $i) != 0 })
Ok(unsafe { (*$PORTX::ptr()).port.read().bits() & (1 << $i) != 0 })
}

fn is_low(&mut self) -> Result<bool, Self::Error> {
Ok(unsafe { (*$PORTX::ptr()).lat.read().bits() & (1 << $i) == 0 })
Ok(unsafe { (*$PORTX::ptr()).port.read().bits() & (1 << $i) == 0 })
}
}

impl eh::InputPin for $PXi<Output<OpenDrain>> {

fn is_high(&mut self) -> Result<bool, Self::Error> {
Ok(unsafe { (*$PORTX::ptr()).lat.read().bits() & (1 << $i) != 0 })
Ok(unsafe { (*$PORTX::ptr()).port.read().bits() & (1 << $i) != 0 })
}

fn is_low(&mut self) -> Result<bool, Self::Error> {
Ok(unsafe { (*$PORTX::ptr()).lat.read().bits() & (1 << $i) == 0 })
Ok(unsafe { (*$PORTX::ptr()).port.read().bits() & (1 << $i) == 0 })
}
}

Expand Down
2 changes: 1 addition & 1 deletion pic32-hal/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::pac::{SPI1, SPI2};
use core::{cmp::max, slice};
use embedded_hal::spi::{ErrorKind, ErrorType, SpiBus};
pub use embedded_hal::spi::{Mode, Phase, Polarity};
pub use embedded_hal::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3};

/// SPI error
pub type Error = ErrorKind;
Expand Down

0 comments on commit b2b289f

Please sign in to comment.