Skip to content

Commit

Permalink
Fix a bug in retrieving register addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
AkiyukiOkayasu committed Feb 20, 2024
1 parent e0ddd91 commit 3685733
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
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 *const _ 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 *const _ 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 *const _ 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 *const _ 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 *const _ as u32, u32::MAX)
}

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

0 comments on commit 3685733

Please sign in to comment.