sam0_common: periph/spi: use sercom_clk_en/dis()
Use already existing functions to turn on / off SERCOM clocks instead of replicating the functionality in the driver.
This commit is contained in:
parent
483feb7ba9
commit
31f88a2d0e
@ -48,20 +48,12 @@ static inline SercomSpi *dev(spi_t bus)
|
|||||||
|
|
||||||
static inline void poweron(spi_t bus)
|
static inline void poweron(spi_t bus)
|
||||||
{
|
{
|
||||||
#if defined(CPU_FAM_SAMD21)
|
sercom_clk_en(dev(bus));
|
||||||
PM->APBCMASK.reg |= (PM_APBCMASK_SERCOM0 << sercom_id(dev(bus)));
|
|
||||||
#elif defined(CPU_SAML21) || defined(CPU_SAML1X)
|
|
||||||
MCLK->APBCMASK.reg |= (MCLK_APBCMASK_SERCOM0 << sercom_id(dev(bus)));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void poweroff(spi_t bus)
|
static inline void poweroff(spi_t bus)
|
||||||
{
|
{
|
||||||
#if defined(CPU_FAM_SAMD21)
|
sercom_clk_dis(dev(bus));
|
||||||
PM->APBCMASK.reg &= ~(PM_APBCMASK_SERCOM0 << sercom_id(dev(bus)));
|
|
||||||
#elif defined(CPU_SAML21) || defined(CPU_SAML1X)
|
|
||||||
MCLK->APBCMASK.reg &= ~(MCLK_APBCMASK_SERCOM0 << sercom_id(dev(bus)));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void spi_init(spi_t bus)
|
void spi_init(spi_t bus)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user