Replaced Hertz by impl Into<Hertz> completely
This commit is contained in:
@ -231,7 +231,7 @@ macro_rules! i2c_base {
|
||||
impl I2cBase<$I2CX> {
|
||||
pub fn $i2cx(
|
||||
i2c: $I2CX,
|
||||
sys_clk: impl Into<Hertz> + Copy,
|
||||
sys_clk: impl Into<Hertz>,
|
||||
speed_mode: I2cSpeed,
|
||||
ms_cfg: Option<&MasterConfig>,
|
||||
sl_cfg: Option<&SlaveConfig>,
|
||||
@ -740,7 +740,7 @@ macro_rules! i2c_slave {
|
||||
fn $i2cx_slave(
|
||||
i2c: $I2CX,
|
||||
cfg: SlaveConfig,
|
||||
sys_clk: impl Into<Hertz> + Copy,
|
||||
sys_clk: impl Into<Hertz>,
|
||||
speed_mode: I2cSpeed,
|
||||
sys_cfg: Option<&mut SYSCONFIG>,
|
||||
) -> Self {
|
||||
@ -897,7 +897,7 @@ macro_rules! i2c_slave {
|
||||
pub fn i2ca(
|
||||
i2c: $I2CX,
|
||||
cfg: SlaveConfig,
|
||||
sys_clk: impl Into<Hertz> + Copy,
|
||||
sys_clk: impl Into<Hertz>,
|
||||
speed_mode: I2cSpeed,
|
||||
sys_cfg: Option<&mut SYSCONFIG>,
|
||||
) -> Result<Self, Error> {
|
||||
@ -912,7 +912,7 @@ macro_rules! i2c_slave {
|
||||
pub fn $i2cx(
|
||||
i2c: $I2CX,
|
||||
cfg: SlaveConfig,
|
||||
sys_clk: impl Into<Hertz> + Copy,
|
||||
sys_clk: impl Into<Hertz>,
|
||||
speed_mode: I2cSpeed,
|
||||
sys_cfg: Option<&mut SYSCONFIG>,
|
||||
) -> Self {
|
||||
|
14
src/spi.rs
14
src/spi.rs
@ -218,9 +218,9 @@ pub struct ReducedTransferConfig {
|
||||
}
|
||||
|
||||
impl TransferConfig<NoneT> {
|
||||
pub fn new_no_hw_cs(spi_clk: Hertz, mode: Mode, blockmode: bool, sod: bool) -> Self {
|
||||
pub fn new_no_hw_cs(spi_clk: impl Into<Hertz>, mode: Mode, blockmode: bool, sod: bool) -> Self {
|
||||
TransferConfig {
|
||||
spi_clk,
|
||||
spi_clk: spi_clk.into(),
|
||||
mode,
|
||||
hw_cs: None,
|
||||
sod,
|
||||
@ -231,14 +231,14 @@ impl TransferConfig<NoneT> {
|
||||
|
||||
impl<HWCS: HwCs> TransferConfig<HWCS> {
|
||||
pub fn new(
|
||||
spi_clk: Hertz,
|
||||
spi_clk: impl Into<Hertz>,
|
||||
mode: Mode,
|
||||
hw_cs: Option<HWCS>,
|
||||
blockmode: bool,
|
||||
sod: bool,
|
||||
) -> Self {
|
||||
TransferConfig {
|
||||
spi_clk,
|
||||
spi_clk: spi_clk.into(),
|
||||
mode,
|
||||
hw_cs,
|
||||
sod,
|
||||
@ -452,7 +452,7 @@ macro_rules! spi {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn cfg_clock(&mut self, spi_clk: Hertz) {
|
||||
pub fn cfg_clock(&mut self, spi_clk: impl Into<Hertz>) {
|
||||
self.spi_base.cfg_clock(spi_clk);
|
||||
}
|
||||
|
||||
@ -482,8 +482,8 @@ macro_rules! spi {
|
||||
|
||||
impl<WORD: Word> SpiBase<$SPIX, WORD> {
|
||||
#[inline]
|
||||
pub fn cfg_clock(&mut self, spi_clk: Hertz) {
|
||||
let clk_prescale = self.sys_clk.0 / (spi_clk.0 * (self.cfg.scrdv as u32 + 1));
|
||||
pub fn cfg_clock(&mut self, spi_clk: impl Into<Hertz>) {
|
||||
let clk_prescale = self.sys_clk.0 / (spi_clk.into().0 * (self.cfg.scrdv as u32 + 1));
|
||||
self.spi
|
||||
.clkprescale
|
||||
.write(|w| unsafe { w.bits(clk_prescale) });
|
||||
|
@ -306,12 +306,12 @@ macro_rules! uart_impl {
|
||||
pins: PINS,
|
||||
config: impl Into<Config>,
|
||||
syscfg: &mut SYSCONFIG,
|
||||
sys_clk: Hertz
|
||||
sys_clk: impl Into<Hertz>
|
||||
) -> Self
|
||||
{
|
||||
enable_peripheral_clock(syscfg, $clk_enb_enum);
|
||||
Uart { uart, pins, tx: Tx::new(), rx: Rx::new() }.init(
|
||||
config.into(), sys_clk
|
||||
config.into(), sys_clk.into()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user