diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-03-01 19:31:18 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-03-01 19:31:18 -0500 |
commit | 309a47c7810bf55d993210c2da014ede7dae8a87 (patch) | |
tree | ee054976fc1f80672030234bfb34548628011767 /src/atsamd/spi.c | |
parent | 946eb6b7ae9e44e984ca1377ae9de5d7a36f2a44 (diff) | |
download | kutter-309a47c7810bf55d993210c2da014ede7dae8a87.tar.gz kutter-309a47c7810bf55d993210c2da014ede7dae8a87.tar.xz kutter-309a47c7810bf55d993210c2da014ede7dae8a87.zip |
atsamd: Reduce memory for have_run_init in spi/i2c
Some of the samd21 chips have limited memory - change the code to
reduce the size of global variables.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/atsamd/spi.c')
-rw-r--r-- | src/atsamd/spi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/atsamd/spi.c b/src/atsamd/spi.c index 4bf281bc..96125d5b 100644 --- a/src/atsamd/spi.c +++ b/src/atsamd/spi.c @@ -13,10 +13,10 @@ void spi_init(uint32_t bus, SercomSpi *ss, uint32_t ctrla, uint32_t baud) { - static int have_run_init[8]; - if (have_run_init[bus]) + static uint8_t have_run_init; + if (have_run_init & (1<<bus)) return; - have_run_init[bus] = 1; + have_run_init |= 1<<bus; ss->CTRLA.reg = 0; ss->CTRLA.reg = ctrla & ~SERCOM_SPI_CTRLA_ENABLE; |