Skip to content

Commit 74bd74c

Browse files
authored
Merge pull request #808 from jannic/prepare-v0.10.2
Prepare v0.10.2
2 parents f7f9313 + ce1cc05 commit 74bd74c

File tree

5 files changed

+60
-33
lines changed

5 files changed

+60
-33
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ You may also want to install these helpful tools:
7373
# Useful to creating UF2 images for the RP2040 USB Bootloader
7474
cargo install elf2uf2-rs --locked
7575
# Useful for flashing over the SWD pins using a supported JTAG probe
76-
cargo install probe-rs --features cli --locked
76+
cargo install --locked probe-rs-tools
7777
```
7878

7979
## Packages
@@ -196,9 +196,11 @@ probe-rs can autodetect your debug probe, which can make it easier to use.
196196
*Step 1* - Install `probe-rs`:
197197

198198
```console
199-
$ cargo install probe-rs --features cli --locked
199+
$ cargo install --locked probe-rs-tools
200200
```
201201

202+
Alternatively, follow the installation instructions on https://probe.rs/.
203+
202204
*Step 2* - Make sure your .cargo/config contains the following:
203205

204206
```toml

rp2040-hal/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.10.2] - 2024-06-07
11+
1012
- Fix oneshot adc read waiting indefinitely - #799 @mjptree
13+
- Fix set_low() and set_high() implementation for OutputPin - #807 @martinsp
14+
- Update install instructions for probe-rs - #804 @jannic
15+
- Fix bad transmutes of references to Qspi pins - #805 @jannic
1116

1217
## [0.10.1] - 2024-04-28
1318

@@ -407,7 +412,8 @@ The Minimum-Supported Rust Version (MSRV) for this release is 1.54.
407412

408413
- Initial release
409414

410-
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/v0.10.1...HEAD
415+
[Unreleased]: https://github.com/rp-rs/rp-hal/compare/v0.10.2...HEAD
416+
[0.10.2]: https://github.com/rp-rs/rp-hal/compare/v0.10.1...v0.10.2
411417
[0.10.1]: https://github.com/rp-rs/rp-hal/compare/v0.10.0...v0.10.1
412418
[0.10.0]: https://github.com/rp-rs/rp-hal/compare/v0.9.1...v0.10.0
413419
[0.9.1]: https://github.com/rp-rs/rp-hal/compare/v0.9.0...v0.9.1

rp2040-hal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rp2040-hal"
3-
version = "0.10.1"
3+
version = "0.10.2"
44
authors = ["The rp-rs Developers"]
55
edition = "2021"
66
homepage = "https://github.com/rp-rs/rp-hal"

rp2040-hal/src/gpio/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,8 +1465,8 @@ mod eh1 {
14651465
use embedded_hal::digital::{ErrorType, InputPin, OutputPin, StatefulOutputPin};
14661466

14671467
use super::{
1468-
func, AnyPin, AsInputPin, Error, FunctionSio, InOutPin, Pin, PinId, PullType, SioConfig,
1469-
SioInput, SioOutput,
1468+
func, AnyPin, AsInputPin, Error, FunctionSio, InOutPin, OutputEnableOverride, Pin, PinId,
1469+
PullType, SioConfig, SioInput, SioOutput,
14701470
};
14711471

14721472
impl<I, P, S> ErrorType for Pin<I, FunctionSio<S>, P>
@@ -1558,12 +1558,17 @@ mod eh1 {
15581558
I: AnyPin,
15591559
{
15601560
fn set_low(&mut self) -> Result<(), Self::Error> {
1561-
self.inner._set_low();
1561+
// The pin is already set to output low but this is inhibited by the override.
1562+
self.inner
1563+
.set_output_enable_override(OutputEnableOverride::Enable);
15621564
Ok(())
15631565
}
15641566

15651567
fn set_high(&mut self) -> Result<(), Self::Error> {
1566-
self.inner._set_high();
1568+
// To set the open-drain pin to high, just disable the output driver by configuring the
1569+
// output override. That way, the DHT11 can still pull the data line down to send its response.
1570+
self.inner
1571+
.set_output_enable_override(OutputEnableOverride::Disable);
15671572
Ok(())
15681573
}
15691574
}

rp2040-hal/src/gpio/pin/pin_sealed.rs

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ macro_rules! accessor_fns {
4343
unsafe {
4444
let sio = &*$crate::pac::SIO::PTR;
4545
match pin.bank {
46-
DynBankId::Bank0 => &sio.[<gpio_ $reg:lower>](),
47-
DynBankId::Qspi => core::mem::transmute(&sio.[<gpio_hi_ $reg:lower>]()),
46+
DynBankId::Bank0 => sio.[<gpio_ $reg:lower>](),
47+
DynBankId::Qspi => core::mem::transmute::<&$crate::pac::sio::[<GPIO_HI_ $reg:upper>],&$crate::pac::sio::[<GPIO_ $reg:upper>]>(sio.[<gpio_hi_ $reg:lower>]()),
4848
}
4949
}
5050
}
@@ -57,19 +57,11 @@ macro_rules! accessor_fns {
5757
match pin.bank {
5858
DynBankId::Bank0 => {
5959
let gpio = unsafe { &*$crate::pac::IO_BANK0::PTR };
60-
&gpio.gpio(usize::from(pin.num)).[<gpio_ $reg:lower>]()
60+
gpio.gpio(usize::from(pin.num)).[<gpio_ $reg:lower>]()
6161
}
6262
DynBankId::Qspi => unsafe {
6363
let qspi = &*$crate::pac::IO_QSPI::PTR;
64-
match pin.num {
65-
0 => core::mem::transmute(&qspi.gpio_qspisclk().[<gpio_ $reg:lower>]()),
66-
1 => core::mem::transmute(&qspi.gpio_qspiss().[<gpio_ $reg:lower>]()),
67-
2 => core::mem::transmute(&qspi.gpio_qspisd0().[<gpio_ $reg:lower>]()),
68-
3 => core::mem::transmute(&qspi.gpio_qspisd1().[<gpio_ $reg:lower>]()),
69-
4 => core::mem::transmute(&qspi.gpio_qspisd2().[<gpio_ $reg:lower>]()),
70-
5 => core::mem::transmute(&qspi.gpio_qspisd3().[<gpio_ $reg:lower>]()),
71-
_ => unreachable!("Invalid QSPI bank pin number."),
72-
}
64+
core::mem::transmute::<&$crate::pac::io_qspi::gpio_qspi::[<GPIO_ $reg:upper>], &$crate::pac::io_bank0::gpio::[<GPIO_ $reg:upper>]>(qspi.gpio_qspi(usize::from(pin.num)).[<gpio_ $reg:lower>]())
7365
},
7466
}
7567
}
@@ -86,14 +78,14 @@ macro_rules! accessor_fns {
8678
let bank = &*$crate::pac::IO_BANK0::PTR;
8779
match proc {
8880
CoreId::Core0 => bank.[<proc0_ $reg:lower>](usize::from(index)),
89-
CoreId::Core1 => core::mem::transmute(&bank.[<proc1_ $reg:lower>](usize::from(index))),
81+
CoreId::Core1 => core::mem::transmute::<&$crate::pac::io_bank0::[<PROC1_ $reg:upper>], &$crate::pac::io_bank0::[<PROC0_ $reg:upper>]>(bank.[<proc1_ $reg:lower>](usize::from(index))),
9082
}
9183
}
9284
DynBankId::Qspi => {
9385
let bank = &*$crate::pac::IO_QSPI::PTR;
9486
match proc {
95-
CoreId::Core0 => core::mem::transmute(&bank.[<proc0_ $reg:lower>]()),
96-
CoreId::Core1 => core::mem::transmute(&bank.[<proc1_ $reg:lower>]()),
87+
CoreId::Core0 => core::mem::transmute::<&$crate::pac::io_qspi::[<PROC0_ $reg:upper>], &$crate::pac::io_bank0::[<PROC0_ $reg:upper>]>(bank.[<proc0_ $reg:lower>]()),
88+
CoreId::Core1 => core::mem::transmute::<&$crate::pac::io_qspi::[<PROC1_ $reg:upper>], &$crate::pac::io_bank0::[<PROC0_ $reg:upper>]>(bank.[<proc1_ $reg:lower>]()),
9789
}
9890
}
9991
};
@@ -115,7 +107,7 @@ macro_rules! accessor_fns {
115107
}
116108
DynBankId::Qspi => {
117109
let bank = &*$crate::pac::IO_QSPI::PTR;
118-
core::mem::transmute(&bank.[< dormant_wake_ $reg:lower>]())
110+
core::mem::transmute::<&$crate::pac::io_qspi::[< DORMANT_WAKE_ $reg:upper >], &$crate::pac::io_bank0::[< DORMANT_WAKE_ $reg:upper >]>(bank.[< dormant_wake_ $reg:lower>]())
119111
}
120112
};
121113
(reg, usize::from(offset))
@@ -140,13 +132,32 @@ where
140132
}
141133
DynBankId::Qspi => unsafe {
142134
let qspi = &*pac::PADS_QSPI::PTR;
135+
use rp2040_pac::{generic::Reg, pads_bank0, pads_qspi};
143136
match pin.num {
144-
0 => core::mem::transmute(&qspi.gpio_qspi_sclk()),
145-
1 => core::mem::transmute(&qspi.gpio_qspi_ss()),
146-
2 => core::mem::transmute(&qspi.gpio_qspi_sd0()),
147-
3 => core::mem::transmute(&qspi.gpio_qspi_sd1()),
148-
4 => core::mem::transmute(&qspi.gpio_qspi_sd2()),
149-
5 => core::mem::transmute(&qspi.gpio_qspi_sd3()),
137+
0 => core::mem::transmute::<
138+
&Reg<pads_qspi::gpio_qspi_sclk::GPIO_QSPI_SCLK_SPEC>,
139+
&Reg<pads_bank0::gpio::GPIO_SPEC>,
140+
>(qspi.gpio_qspi_sclk()),
141+
1 => core::mem::transmute::<
142+
&Reg<pads_qspi::gpio_qspi_ss::GPIO_QSPI_SS_SPEC>,
143+
&Reg<pads_bank0::gpio::GPIO_SPEC>,
144+
>(qspi.gpio_qspi_ss()),
145+
2 => core::mem::transmute::<
146+
&Reg<pads_qspi::gpio_qspi_sd0::GPIO_QSPI_SD0_SPEC>,
147+
&Reg<pads_bank0::gpio::GPIO_SPEC>,
148+
>(qspi.gpio_qspi_sd0()),
149+
3 => core::mem::transmute::<
150+
&Reg<pads_qspi::gpio_qspi_sd1::GPIO_QSPI_SD1_SPEC>,
151+
&Reg<pads_bank0::gpio::GPIO_SPEC>,
152+
>(qspi.gpio_qspi_sd1()),
153+
4 => core::mem::transmute::<
154+
&Reg<pads_qspi::gpio_qspi_sd2::GPIO_QSPI_SD2_SPEC>,
155+
&Reg<pads_bank0::gpio::GPIO_SPEC>,
156+
>(qspi.gpio_qspi_sd2()),
157+
5 => core::mem::transmute::<
158+
&Reg<pads_qspi::gpio_qspi_sd3::GPIO_QSPI_SD3_SPEC>,
159+
&Reg<pads_bank0::gpio::GPIO_SPEC>,
160+
>(qspi.gpio_qspi_sd3()),
150161
_ => unreachable!("Invalid QSPI bank pin number."),
151162
}
152163
},
@@ -165,13 +176,16 @@ where
165176
accessor_fns!(sio oe_clr);
166177
accessor_fns!(sio oe_xor);
167178

168-
fn proc_in_by_pass(&self) -> &crate::pac::syscfg::PROC_IN_SYNC_BYPASS {
179+
fn proc_in_by_pass(&self) -> &pac::syscfg::PROC_IN_SYNC_BYPASS {
169180
let pin = self.as_dyn();
170181
unsafe {
171182
let syscfg = &*pac::SYSCFG::PTR;
172183
match pin.bank {
173184
DynBankId::Bank0 => syscfg.proc_in_sync_bypass(),
174-
DynBankId::Qspi => core::mem::transmute(&syscfg.proc_in_sync_bypass_hi()),
185+
DynBankId::Qspi => core::mem::transmute::<
186+
&pac::syscfg::PROC_IN_SYNC_BYPASS_HI,
187+
&pac::syscfg::PROC_IN_SYNC_BYPASS,
188+
>(syscfg.proc_in_sync_bypass_hi()),
175189
}
176190
}
177191
}
@@ -187,7 +201,7 @@ where
187201
}
188202
DynBankId::Qspi => {
189203
let bank = &*pac::IO_QSPI::PTR;
190-
core::mem::transmute(&bank.intr())
204+
core::mem::transmute::<&pac::io_qspi::INTR, &pac::io_bank0::INTR>(bank.intr())
191205
}
192206
};
193207

0 commit comments

Comments
 (0)