summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-09-30 21:34:50 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-09-30 21:34:50 +0200
commit5e7af0cc485557864373c2396b57431250d7b1b0 (patch)
treedb1a06697f2b7008dc5b16da5b620a97b527de49
parent1249920a6c7094f923e77f7d2131978e19604396 (diff)
arduino-nano spi: add missing counter variable initializr
-rw-r--r--src/arch/arduino-nano/driver/spi.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/arch/arduino-nano/driver/spi.cc b/src/arch/arduino-nano/driver/spi.cc
index 2ba93cb..bef218c 100644
--- a/src/arch/arduino-nano/driver/spi.cc
+++ b/src/arch/arduino-nano/driver/spi.cc
@@ -12,6 +12,7 @@ signed char SPI::setup()
{
// configure SS as output to avoid unintened switches to slave mode
gpio.output(GPIO::pb2, 0);
+ // TODO configure MOSI and SCK as output
// up to 1 MHz SPI clock
#if F_CPU == 16000000UL
SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0);
@@ -26,7 +27,7 @@ signed char SPI::xmit(
unsigned char tx_len, unsigned char *tx_buf,
unsigned char rx_len, unsigned char *rx_buf)
{
- unsigned char i;
+ unsigned char i = 0;
while ((i < tx_len) || (i < rx_len)) {
if (i < tx_len) {