From 17e112cdd25a2c21c0445180404c7f21a1176c73 Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Mon, 6 May 2019 10:52:50 +0200
Subject: [PATCH] fix(board): Change voltages based on selected board

---
 Hello_World/Makefile                                   |  3 ++-
 Hello_World/main.c                                     | 10 ++++++++--
 sdk/Libraries/Boards/EvKit_V1/board.mk                 |  2 ++
 sdk/Libraries/Boards/card10/board.mk                   |  1 +
 .../Device/Maxim/MAX32665/Source/system_max32665.c     |  2 ++
 5 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Hello_World/Makefile b/Hello_World/Makefile
index e8bcc558..e67468b0 100644
--- a/Hello_World/Makefile
+++ b/Hello_World/Makefile
@@ -53,7 +53,8 @@ COMPILER=GCC
 
 # Specify the board used
 ifeq "$(BOARD)" ""
-BOARD=EvKit_V1
+#BOARD=EvKit_V1
+BOARD=card10
 endif
 
 # This is the path to the CMSIS root directory
diff --git a/Hello_World/main.c b/Hello_World/main.c
index b2ff8b22..3dbbb0bc 100644
--- a/Hello_World/main.c
+++ b/Hello_World/main.c
@@ -109,14 +109,20 @@ void pmic_init(void)
     MAX77650_setEN_SBB0(0b110); //Enable SBB0 is on irrespective of FPS whenever the on/off controller is in its "On via Software" or "On via On/Off Controller" states
 
     MAX77650_setIP_SBB1(0b11);  //Limit output of SBB1 to 500mA
+#if BOARD_EVKIT
     MAX77650_setTV_SBB1(0b100000); //Set output Voltage of SBB1 to 1.2V
-    //MAX77650_setTV_SBB1(0b100010); //Set output Voltage of SBB1 to 3.3V
+#else
+    MAX77650_setTV_SBB1(0b100010); //Set output Voltage of SBB1 to 3.3V
+#endif
     MAX77650_setADE_SBB1(0b0); //Disable Active Discharge at SBB1 Output
     MAX77650_setEN_SBB1(0b110); //Enable SBB1 is on irrespective of FPS whenever the on/off controller is in its "On via Software" or "On via On/Off Controller" states
 
     MAX77650_setIP_SBB2(0b11);  //Limit output of SBB2 to 500mA
+#if BOARD_EVKIT
     MAX77650_setTV_SBB2(0b110010); //Set output Voltage of SBB2 to 3.3V
-    //MAX77650_setTV_SBB2(0b110100); //Set output Voltage of SBB2 to 5.0V
+#else
+    MAX77650_setTV_SBB2(0b110100); //Set output Voltage of SBB2 to 5.0V
+#endif
     MAX77650_setADE_SBB2(0b0); //Disable Active Discharge at SBB2 Output
     MAX77650_setEN_SBB2(0b110); //Enable SBB2 is on irrespective of FPS whenever the on/off controller is in its "On via Software" or "On via On/Off Controller" states
 
diff --git a/sdk/Libraries/Boards/EvKit_V1/board.mk b/sdk/Libraries/Boards/EvKit_V1/board.mk
index 6bb725d4..db2e92c9 100644
--- a/sdk/Libraries/Boards/EvKit_V1/board.mk
+++ b/sdk/Libraries/Boards/EvKit_V1/board.mk
@@ -50,6 +50,8 @@ SRCS += mx25.c
 SRCS += pb.c
 
 
+PROJ_CFLAGS += -DBOARD_EVKIT=1
+
 # Where to find BSP source files
 VPATH += $(BOARD_DIR)/Source
 VPATH += $(BOARD_DIR)/../Source
diff --git a/sdk/Libraries/Boards/card10/board.mk b/sdk/Libraries/Boards/card10/board.mk
index 6bb725d4..7799efbc 100644
--- a/sdk/Libraries/Boards/card10/board.mk
+++ b/sdk/Libraries/Boards/card10/board.mk
@@ -49,6 +49,7 @@ SRCS += led.c
 SRCS += mx25.c
 SRCS += pb.c
 
+PROJ_CFLAGS += -DBOARD_CARD10=1
 
 # Where to find BSP source files
 VPATH += $(BOARD_DIR)/Source
diff --git a/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c b/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c
index 35f32346..75389d40 100644
--- a/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c
+++ b/sdk/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c
@@ -180,7 +180,9 @@ __weak void SystemInit(void)
     MXC_GPIO1->vssel |= (1 << 6) | (1 << 7); // GPIO to TOP
     MXC_GPIO1->vssel |= (1 << 14) | (1 << 15); // GPIO for RGB LEDs
 
+#if BOARD_EVKIT
     MXC_GPIO1->vssel |= (1 << 8) | (1 << 9) |  (1 << 10) | (1 << 11) | (1 << 12); // TODO: TMP for devboard
+#endif
 
     MXC_GPIO1->ps |= 0xFFFFFFFF;
     MXC_GPIO1->pad_cfg1 |= 0xFFFFFFFF;
-- 
GitLab