Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use as_ptr() to retrieve pointer to register #776

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion rp2040-hal/src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ impl<'a, Word> AdcFifo<'a, Word> {
/// The [`DmaReadTarget`] returned by this function can be used to initiate DMA transfers
/// reading from the ADC.
pub fn dma_read_target(&self) -> DmaReadTarget<Word> {
DmaReadTarget(self.adc.device.fifo() as *const _ as u32, PhantomData)
DmaReadTarget(self.adc.device.fifo().as_ptr() as u32, PhantomData)
}
}

Expand Down
4 changes: 2 additions & 2 deletions rp2040-hal/src/pio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ unsafe impl<SM: ValidStateMachine> ReadTarget for Rx<SM> {

fn rx_address_count(&self) -> (u32, u32) {
(
unsafe { &*self.block }.rxf(SM::id()) as *const _ as u32,
unsafe { &*self.block }.rxf(SM::id()).as_ptr() as u32,
u32::MAX,
)
}
Expand Down Expand Up @@ -1626,7 +1626,7 @@ unsafe impl<SM: ValidStateMachine> WriteTarget for Tx<SM> {

fn tx_address_count(&mut self) -> (u32, u32) {
(
unsafe { &*self.block }.txf(SM::id()) as *const _ as u32,
unsafe { &*self.block }.txf(SM::id()).as_ptr() as u32,
u32::MAX,
)
}
Expand Down
4 changes: 2 additions & 2 deletions rp2040-hal/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ macro_rules! impl_write {

fn rx_address_count(&self) -> (u32, u32) {
(
self.device.sspdr() as *const _ as u32,
self.device.sspdr().as_ptr() as u32,
u32::MAX,
)
}
Expand All @@ -541,7 +541,7 @@ macro_rules! impl_write {

fn tx_address_count(&mut self) -> (u32, u32) {
(
self.device.sspdr() as *const _ as u32,
self.device.sspdr().as_ptr() as u32,
u32::MAX,
)
}
Expand Down
2 changes: 1 addition & 1 deletion rp2040-hal/src/uart/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ unsafe impl<D: UartDevice, P: ValidUartPinout<D>> ReadTarget for Reader<D, P> {
}

fn rx_address_count(&self) -> (u32, u32) {
(self.device.uartdr() as *const _ as u32, u32::MAX)
(self.device.uartdr().as_ptr() as u32, u32::MAX)
}

fn rx_increment(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion rp2040-hal/src/uart/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ unsafe impl<D: UartDevice, P: ValidUartPinout<D>> WriteTarget for Writer<D, P> {
}

fn tx_address_count(&mut self) -> (u32, u32) {
(self.device.uartdr() as *const _ as u32, u32::MAX)
(self.device.uartdr().as_ptr() as u32, u32::MAX)
}

fn tx_increment(&self) -> bool {
Expand Down