From 3ba73b5ff45084e8d9a662220981f7d503aba251 Mon Sep 17 00:00:00 2001 From: OueslatiGhaith Date: Thu, 27 Apr 2023 16:08:57 +0100 Subject: [PATCH] fixed mistake with casting channel to a usize --- embassy-stm32/src/ipcc.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/embassy-stm32/src/ipcc.rs b/embassy-stm32/src/ipcc.rs index e5ec58ada..43105c1d1 100644 --- a/embassy-stm32/src/ipcc.rs +++ b/embassy-stm32/src/ipcc.rs @@ -59,94 +59,94 @@ impl<'d> Ipcc<'d> { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { regs.cpu(0).mr().modify(|w| w.set_chom(channel.into(), !enabled)) } + unsafe { regs.cpu(0).mr().modify(|w| w.set_chom(channel as usize, !enabled)) } } pub fn c1_get_rx_channel(&self, channel: IpccChannel) -> bool { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { !regs.cpu(0).mr().read().chom(channel.into()) } + unsafe { !regs.cpu(0).mr().read().chom(channel as usize) } } pub fn c2_set_rx_channel(&mut self, channel: IpccChannel, enabled: bool) { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { regs.cpu(1).mr().modify(|w| w.set_chom(channel.into(), !enabled)) } + unsafe { regs.cpu(1).mr().modify(|w| w.set_chom(channel as usize, !enabled)) } } pub fn c2_get_rx_channel(&self, channel: IpccChannel) -> bool { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { !regs.cpu(1).mr().read().chom(channel.into()) } + unsafe { !regs.cpu(1).mr().read().chom(channel as usize) } } pub fn c1_set_tx_channel(&mut self, channel: IpccChannel, enabled: bool) { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { regs.cpu(0).mr().modify(|w| w.set_chfm(channel.into(), !enabled)) } + unsafe { regs.cpu(0).mr().modify(|w| w.set_chfm(channel as usize, !enabled)) } } pub fn c1_get_tx_channel(&self, channel: IpccChannel) -> bool { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { !regs.cpu(0).mr().read().chfm(channel.into()) } + unsafe { !regs.cpu(0).mr().read().chfm(channel as usize) } } pub fn c2_set_tx_channel(&mut self, channel: IpccChannel, enabled: bool) { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { regs.cpu(1).mr().modify(|w| w.set_chfm(channel.into(), !enabled)) } + unsafe { regs.cpu(1).mr().modify(|w| w.set_chfm(channel as usize, !enabled)) } } pub fn c2_get_tx_channel(&self, channel: IpccChannel) -> bool { let regs = IPCC::regs(); // If bit is set to 1 then interrupt is disabled - unsafe { !regs.cpu(1).mr().read().chfm(channel.into()) } + unsafe { !regs.cpu(1).mr().read().chfm(channel as usize) } } /// clears IPCC receive channel status for CPU1 pub fn c1_clear_flag_channel(&mut self, channel: IpccChannel) { let regs = IPCC::regs(); - unsafe { regs.cpu(0).scr().write(|w| w.set_chc(channel.into(), true)) } + unsafe { regs.cpu(0).scr().write(|w| w.set_chc(channel as usize, true)) } } /// clears IPCC receive channel status for CPU2 pub fn c2_clear_flag_channel(&mut self, channel: IpccChannel) { let regs = IPCC::regs(); - unsafe { regs.cpu(1).scr().write(|w| w.set_chc(channel.into(), true)) } + unsafe { regs.cpu(1).scr().write(|w| w.set_chc(channel as usize, true)) } } pub fn c1_set_flag_channel(&mut self, channel: IpccChannel) { let regs = IPCC::regs(); - unsafe { regs.cpu(0).scr().write(|w| w.set_chs(channel.into(), true)) } + unsafe { regs.cpu(0).scr().write(|w| w.set_chs(channel as usize, true)) } } pub fn c2_set_flag_channel(&mut self, channel: IpccChannel) { let regs = IPCC::regs(); - unsafe { regs.cpu(1).scr().write(|w| w.set_chs(channel.into(), true)) } + unsafe { regs.cpu(1).scr().write(|w| w.set_chs(channel as usize, true)) } } pub fn c1_is_active_flag(&self, channel: IpccChannel) -> bool { let regs = IPCC::regs(); - unsafe { regs.cpu(0).sr().read().chf(channel.into()) } + unsafe { regs.cpu(0).sr().read().chf(channel as usize) } } pub fn c2_is_active_flag(&self, channel: IpccChannel) -> bool { let regs = IPCC::regs(); - unsafe { regs.cpu(1).sr().read().chf(channel.into()) } + unsafe { regs.cpu(1).sr().read().chf(channel as usize) } } pub fn is_tx_pending(&self, channel: IpccChannel) -> bool {