From c3b7a0189196c39a92e2efa14e6ce107cd4fe6eb Mon Sep 17 00:00:00 2001
From: Alex Demenchuk <alexander.demenchuk@gmail.com>
Date: Tue, 5 Jun 2018 16:17:26 -0400
Subject: [PATCH] Add SPI3 SUPPORT preprocessor macro to CFLAGS

---
 extras/ssd1306/component.mk | 4 +++-
 extras/ssd1306/ssd1306.c    | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/extras/ssd1306/component.mk b/extras/ssd1306/component.mk
index f12a292..2cfb14d 100644
--- a/extras/ssd1306/component.mk
+++ b/extras/ssd1306/component.mk
@@ -7,11 +7,13 @@ INC_DIRS += $(ssd1306_ROOT)..
 SSD1306_I2C_SUPPORT ?= 1
 # SPI4 support is on by default
 SSD1306_SPI4_SUPPORT ?= 1
+# SPI3 support is on by default
+SSD1306_SPI3_SUPPORT ?= 1
 
 # args for passing into compile rule generation
 ssd1306_SRC_DIR = $(ssd1306_ROOT)
 
-ssd1306_CFLAGS = -DSSD1306_I2C_SUPPORT=${SSD1306_I2C_SUPPORT} -DSSD1306_SPI4_SUPPORT=${SSD1306_SPI4_SUPPORT} $(CFLAGS)
+ssd1306_CFLAGS = -DSSD1306_I2C_SUPPORT=${SSD1306_I2C_SUPPORT} -DSSD1306_SPI4_SUPPORT=${SSD1306_SPI4_SUPPORT} -DSSD1306_SPI3_SUPPORT=${SSD1306_SPI3_SUPPORT} $(CFLAGS)
 
 
 $(eval $(call component_compile_rules,ssd1306))
diff --git a/extras/ssd1306/ssd1306.c b/extras/ssd1306/ssd1306.c
index 6ce2c74..df188c5 100644
--- a/extras/ssd1306/ssd1306.c
+++ b/extras/ssd1306/ssd1306.c
@@ -236,7 +236,9 @@ static int sh1106_go_coordinate(const ssd1306_t *dev, uint8_t x, uint8_t y)
 int ssd1306_load_frame_buffer(const ssd1306_t *dev, uint8_t buf[])
 {
     uint16_t i;
+#if (SSD1306_SPI3_SUPPORT)
     uint8_t j;
+#endif
 #if (SSD1306_I2C_SUPPORT)
     uint8_t tab[16] = { 0 };
 #endif