From 6e78c2056a718d7f817b7cd373f33a85b366046a Mon Sep 17 00:00:00 2001
From: Matthias Ringwald <matthias@ringwald.ch>
Date: Sun, 25 Jun 2017 10:46:06 +0200
Subject: [PATCH] stm32-l053r8-em9304: use PC0=A5 as debug output #0

---
 .../cubemx-l053r8-em9304/Inc/main.h           |  2 ++
 .../cubemx-l053r8-em9304/Makefile             |  2 +-
 .../cubemx-l053r8-em9304/Src/main.c           | 10 +++++++
 .../cubemx-l053r8-em9304.ioc                  | 29 +++++++++++--------
 4 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Inc/main.h b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Inc/main.h
index e129ff454..29b0e9196 100644
--- a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Inc/main.h
+++ b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Inc/main.h
@@ -48,6 +48,8 @@
 
 #define B1_Pin GPIO_PIN_13
 #define B1_GPIO_Port GPIOC
+#define DEBUG_0_Pin GPIO_PIN_0
+#define DEBUG_0_GPIO_Port GPIOC
 #define USART_TX_Pin GPIO_PIN_2
 #define USART_TX_GPIO_Port GPIOA
 #define USART_RX_Pin GPIO_PIN_3
diff --git a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Makefile b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Makefile
index 287b50e03..0304834c8 100644
--- a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Makefile
+++ b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Makefile
@@ -1,5 +1,5 @@
 ##########################################################################################################################
-# File automatically-generated by tool: [projectgenerator] version: [2.23.0] date: [Sat Jun 24 23:09:09 CEST 2017] 
+# File automatically-generated by tool: [projectgenerator] version: [2.23.0] date: [Sun Jun 25 10:44:49 CEST 2017] 
 ##########################################################################################################################
 
 # ------------------------------------------------
diff --git a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Src/main.c b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Src/main.c
index 0a039085b..00ddc332c 100644
--- a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Src/main.c
+++ b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/Src/main.c
@@ -252,6 +252,9 @@ static void MX_GPIO_Init(void)
   __HAL_RCC_GPIOA_CLK_ENABLE();
   __HAL_RCC_GPIOB_CLK_ENABLE();
 
+  /*Configure GPIO pin Output Level */
+  HAL_GPIO_WritePin(DEBUG_0_GPIO_Port, DEBUG_0_Pin, GPIO_PIN_RESET);
+
   /*Configure GPIO pin Output Level */
   HAL_GPIO_WritePin(EN_GPIO_Port, EN_Pin, GPIO_PIN_RESET);
 
@@ -264,6 +267,13 @@ static void MX_GPIO_Init(void)
   GPIO_InitStruct.Pull = GPIO_NOPULL;
   HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
 
+  /*Configure GPIO pin : DEBUG_0_Pin */
+  GPIO_InitStruct.Pin = DEBUG_0_Pin;
+  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+  GPIO_InitStruct.Pull = GPIO_NOPULL;
+  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+  HAL_GPIO_Init(DEBUG_0_GPIO_Port, &GPIO_InitStruct);
+
   /*Configure GPIO pins : EN_Pin SPI1_CSN_Pin */
   GPIO_InitStruct.Pin = EN_Pin|SPI1_CSN_Pin;
   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
diff --git a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/cubemx-l053r8-em9304.ioc b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/cubemx-l053r8-em9304.ioc
index 87218b312..3491e02f7 100644
--- a/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/cubemx-l053r8-em9304.ioc
+++ b/port/stm32-l053r8-em9304/cubemx-l053r8-em9304/cubemx-l053r8-em9304.ioc
@@ -34,21 +34,22 @@ Mcu.Name=STM32L053R(6-8)Tx
 Mcu.Package=LQFP64
 Mcu.Pin0=PC13
 Mcu.Pin1=PC14-OSC32_IN
-Mcu.Pin10=PB10
-Mcu.Pin11=PA9
-Mcu.Pin12=PA13
-Mcu.Pin13=PA14
-Mcu.Pin14=PB6
-Mcu.Pin15=VP_SYS_VS_Systick
+Mcu.Pin10=PA7
+Mcu.Pin11=PB10
+Mcu.Pin12=PA9
+Mcu.Pin13=PA13
+Mcu.Pin14=PA14
+Mcu.Pin15=PB6
+Mcu.Pin16=VP_SYS_VS_Systick
 Mcu.Pin2=PC15-OSC32_OUT
 Mcu.Pin3=PH0-OSC_IN
 Mcu.Pin4=PH1-OSC_OUT
-Mcu.Pin5=PA2
-Mcu.Pin6=PA3
-Mcu.Pin7=PA5
-Mcu.Pin8=PA6
-Mcu.Pin9=PA7
-Mcu.PinsNb=16
+Mcu.Pin5=PC0
+Mcu.Pin6=PA2
+Mcu.Pin7=PA3
+Mcu.Pin8=PA5
+Mcu.Pin9=PA6
+Mcu.PinsNb=17
 Mcu.UserConstants=
 Mcu.UserName=STM32L053R8Tx
 MxCube.Version=4.21.0
@@ -99,6 +100,10 @@ PB6.GPIO_Label=SPI1_CSN
 PB6.Locked=true
 PB6.PinState=GPIO_PIN_SET
 PB6.Signal=GPIO_Output
+PC0.GPIOParameters=GPIO_Label
+PC0.GPIO_Label=DEBUG_0
+PC0.Locked=true
+PC0.Signal=GPIO_Output
 PC13.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
 PC13.GPIO_Label=B1 [Blue PushButton]
 PC13.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING