aboutsummaryrefslogtreecommitdiffstats
path: root/src/atsamd/i2c.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-03-01 19:31:18 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-03-01 19:31:18 -0500
commit309a47c7810bf55d993210c2da014ede7dae8a87 (patch)
treeee054976fc1f80672030234bfb34548628011767 /src/atsamd/i2c.c
parent946eb6b7ae9e44e984ca1377ae9de5d7a36f2a44 (diff)
downloadkutter-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/i2c.c')
-rw-r--r--src/atsamd/i2c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/atsamd/i2c.c b/src/atsamd/i2c.c
index 89b190fa..e5e0a379 100644
--- a/src/atsamd/i2c.c
+++ b/src/atsamd/i2c.c
@@ -16,10 +16,10 @@
static void
i2c_init(uint32_t bus, SercomI2cm *si)
{
- 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;
// Configure i2c
si->CTRLA.reg = 0;