Skip to content

Commit

Permalink
Avoid setting the frequency if current frequency is the same
Browse files Browse the repository at this point in the history
  • Loading branch information
acassis committed Jul 19, 2020
1 parent af0690a commit 2905542
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/xtensa/src/esp32/esp32_spi.c
Expand Up @@ -438,6 +438,13 @@ static uint32_t esp32_spi_setfrequency(FAR struct spi_dev_s *dev,
FAR struct esp32_spi_priv_s *priv = (FAR struct esp32_spi_priv_s *)dev;
const uint32_t duty_cycle = 128;

if (priv->frequency == frequency)
{
/* We are already at this frequency. Return the actual. */

return priv->actual;
}

if (frequency > ((APB_CLK_FREQ / 4) * 3))
{
reg_val = SPI_CLK_EQU_SYSCLK_M;
Expand Down

0 comments on commit 2905542

Please sign in to comment.