Skip to content

Commit 4fd6e7d

Browse files
committed
Clarify Xh3irq testing
I switched to the ADC FIFO IRQ so that the index and the bit number would be different.
1 parent bc8aff8 commit 4fd6e7d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

rp235x-hal/src/xh3irq.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,20 @@ mod test {
222222

223223
#[test]
224224
fn test_interrupt_to_mask() {
225-
let (index, bitmask) = interrupt_to_mask(rp235x_pac::Interrupt::UART1_IRQ);
226-
// 34 -> window 2, bit 3
225+
let (index, bitmask) = interrupt_to_mask(rp235x_pac::Interrupt::ADC_IRQ_FIFO);
226+
assert_eq!(rp235x_pac::Interrupt::ADC_IRQ_FIFO as u16, 35);
227+
// ADC_IRQ_FIFO is IRQ 35, so that's index 2, bit 3
227228
assert_eq!(index, 2);
228-
assert_eq!(bitmask, 0b0000_0000_0000_0100);
229+
assert_eq!(bitmask, 1 << 3);
229230
}
230231

231232
#[test]
232233
fn test_interrupt_to_mask_index() {
233-
let mask = interrupt_to_mask_index(rp235x_pac::Interrupt::UART1_IRQ);
234-
// 34 -> bit 3 | window 2
235-
assert_eq!(mask, 0x0004_0002);
234+
let mask = interrupt_to_mask_index(rp235x_pac::Interrupt::ADC_IRQ_FIFO);
235+
assert_eq!(rp235x_pac::Interrupt::ADC_IRQ_FIFO as u16, 35);
236+
// ADC_IRQ_FIFO is IRQ 35, so that's index 2, bit 3
237+
// This value is in (bitmask | index) format, and 1 << 3 is 0x0008
238+
assert_eq!(mask, 0x0008_0002);
236239
}
237240
}
238241

0 commit comments

Comments
 (0)