cc2538: spi: Add enable and disable functions
This makes it possible to reduce the power consumption when the SPI is unused. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
This commit is contained in:
parent
b134e35450
commit
e8a8870d1d
2 changed files with 30 additions and 2 deletions
|
@ -74,8 +74,7 @@
|
|||
void
|
||||
spi_init(void)
|
||||
{
|
||||
/* Enable the SSI peripheral */
|
||||
REG(SYS_CTRL_RCGCSSI) |= 1;
|
||||
spi_enable();
|
||||
|
||||
/* Start by disabling the peripheral before configuring it */
|
||||
REG(SSI0_BASE + SSI_CR1) = 0;
|
||||
|
@ -110,4 +109,18 @@ spi_init(void)
|
|||
/* Enable the SSI */
|
||||
REG(SSI0_BASE + SSI_CR1) |= SSI_CR1_SSE;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
spi_enable(void)
|
||||
{
|
||||
/* Enable the clock for the SSI peripheral */
|
||||
REG(SYS_CTRL_RCGCSSI) |= 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
spi_disable(void)
|
||||
{
|
||||
/* Gate the clock for the SSI peripheral */
|
||||
REG(SYS_CTRL_RCGCSSI) &= ~1;
|
||||
}
|
||||
/** @} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue