update cube project

fake-chip
Ondřej Hruška 2 years ago
parent e576d5847c
commit 9bbed9f1c4
  1. 80
      BluepillTrouba.ioc
  2. 132
      BluepillTrouba.txt
  3. 26
      Core/Inc/main.h
  4. 3
      Core/Inc/tim.h
  5. 20
      Core/Src/gpio.c
  6. 1
      Core/Src/main.c
  7. 101
      Core/Src/tim.c
  8. 2
      Makefile
  9. BIN
      pt100.gnumeric

@ -42,8 +42,9 @@ Mcu.CPN=STM32F103CBT6
Mcu.Family=STM32F1
Mcu.IP0=ADC1
Mcu.IP1=DMA
Mcu.IP10=TIM4
Mcu.IP11=USART1
Mcu.IP10=TIM3
Mcu.IP11=TIM4
Mcu.IP12=USART1
Mcu.IP2=FREERTOS
Mcu.IP3=IWDG
Mcu.IP4=NVIC
@ -52,23 +53,23 @@ Mcu.IP6=RTC
Mcu.IP7=SPI1
Mcu.IP8=SYS
Mcu.IP9=TIM2
Mcu.IPNb=12
Mcu.IPNb=13
Mcu.Name=STM32F103C(8-B)Tx
Mcu.Package=LQFP48
Mcu.Pin0=PC13-TAMPER-RTC
Mcu.Pin1=PC14-OSC32_IN
Mcu.Pin10=PA6
Mcu.Pin11=PA7
Mcu.Pin12=PB11
Mcu.Pin10=PB0
Mcu.Pin11=PB1
Mcu.Pin12=PB10
Mcu.Pin13=PA9
Mcu.Pin14=PA10
Mcu.Pin15=PA13
Mcu.Pin16=PA14
Mcu.Pin17=PA15
Mcu.Pin18=PB5
Mcu.Pin19=PB6
Mcu.Pin18=PB6
Mcu.Pin19=PB7
Mcu.Pin2=PC15-OSC32_OUT
Mcu.Pin20=PB7
Mcu.Pin20=PB8
Mcu.Pin21=VP_ADC1_TempSens_Input
Mcu.Pin22=VP_ADC1_Vref_Input
Mcu.Pin23=VP_FREERTOS_VS_CMSIS_V2
@ -77,14 +78,15 @@ Mcu.Pin25=VP_RTC_VS_RTC_Activate
Mcu.Pin26=VP_RTC_No_RTC_Output
Mcu.Pin27=VP_SYS_VS_tim1
Mcu.Pin28=VP_TIM2_VS_ClockSourceINT
Mcu.Pin29=VP_TIM3_VS_ClockSourceINT
Mcu.Pin3=PD0-OSC_IN
Mcu.Pin4=PD1-OSC_OUT
Mcu.Pin5=PA0-WKUP
Mcu.Pin6=PA1
Mcu.Pin7=PA3
Mcu.Pin8=PA4
Mcu.Pin9=PA5
Mcu.PinsNb=29
Mcu.Pin7=PA5
Mcu.Pin8=PA6
Mcu.Pin9=PA7
Mcu.PinsNb=30
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F103CBTx
@ -128,45 +130,43 @@ PA15.GPIOParameters=GPIO_Speed,GPIO_Label
PA15.GPIO_Label=BUZZER
PA15.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PA15.Signal=S_TIM2_CH1_ETR
PA3.GPIOParameters=GPIO_Label
PA3.GPIO_Label=OLED_RST
PA3.Locked=true
PA3.Signal=GPIO_Output
PA4.GPIOParameters=GPIO_Label
PA4.GPIO_Label=OLED_DC
PA4.Locked=true
PA4.Signal=GPIO_Output
PA5.GPIOParameters=GPIO_Label
PA5.GPIO_Label=OLED_SCLK
PA5.Mode=TX_Only_Simplex_Unidirect_Master
PA5.Signal=SPI1_SCK
PA6.GPIOParameters=GPIO_Label
PA6.GPIO_Label=OLED_CS
PA6.Locked=true
PA6.Signal=GPIO_Output
PA6.GPIO_Label=HEATER
PA6.Signal=S_TIM3_CH1
PA7.GPIOParameters=GPIO_Label
PA7.GPIO_Label=OLED_MOSI
PA7.Mode=TX_Only_Simplex_Unidirect_Master
PA7.Signal=SPI1_MOSI
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
PB11.GPIOParameters=GPIO_Label
PB11.GPIO_Label=HEATER
PB11.Locked=true
PB11.Signal=GPIO_Output
PB5.GPIOParameters=GPIO_PuPd,GPIO_Label
PB5.GPIO_Label=KNOB_PUSH
PB5.GPIO_PuPd=GPIO_PULLUP
PB5.Locked=true
PB5.Signal=GPIO_Input
PB0.GPIOParameters=GPIO_Label
PB0.GPIO_Label=OLED_CS
PB0.Locked=true
PB0.Signal=GPIO_Output
PB1.GPIOParameters=GPIO_Label
PB1.GPIO_Label=OLED_DC
PB1.Locked=true
PB1.Signal=GPIO_Output
PB10.GPIOParameters=GPIO_Label
PB10.GPIO_Label=OLED_RST
PB10.Locked=true
PB10.Signal=GPIO_Output
PB6.GPIOParameters=GPIO_PuPd,GPIO_Label
PB6.GPIO_Label=KNOB_B
PB6.GPIO_Label=KNOB_A
PB6.GPIO_PuPd=GPIO_PULLUP
PB6.Signal=S_TIM4_CH1
PB7.GPIOParameters=GPIO_PuPd,GPIO_Label
PB7.GPIO_Label=KNOB_A
PB7.GPIO_Label=KNOB_B
PB7.GPIO_PuPd=GPIO_PULLUP
PB7.Signal=S_TIM4_CH2
PB8.GPIOParameters=GPIO_Label
PB8.GPIO_Label=KNOB_PUSH
PB8.Locked=true
PB8.Signal=GPIO_Input
PC13-TAMPER-RTC.GPIOParameters=GPIO_Label
PC13-TAMPER-RTC.GPIO_Label=LED
PC13-TAMPER-RTC.Locked=true
@ -207,7 +207,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=Makefile
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_IWDG_Init-IWDG-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_DMA_Init-DMA-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_TIM2_Init-TIM2-false-HAL-true
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_IWDG_Init-IWDG-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_SPI1_Init-SPI1-false-HAL-true,7-MX_DMA_Init-DMA-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_TIM2_Init-TIM2-false-HAL-true,10-MX_RTC_Init-RTC-false-HAL-true
RCC.ADCFreqValue=2250000
RCC.ADCPresc=RCC_ADCPCLK2_DIV8
RCC.AHBFreq_Value=72000000
@ -239,6 +239,8 @@ SH.ADCx_IN1.0=ADC1_IN1,IN1
SH.ADCx_IN1.ConfNb=1
SH.S_TIM2_CH1_ETR.0=TIM2_CH1,PWM Generation1 CH1
SH.S_TIM2_CH1_ETR.ConfNb=1
SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
SH.S_TIM3_CH1.ConfNb=1
SH.S_TIM4_CH1.0=TIM4_CH1,Encoder_Interface
SH.S_TIM4_CH1.ConfNb=1
SH.S_TIM4_CH2.0=TIM4_CH2,Encoder_Interface
@ -252,6 +254,10 @@ SPI1.VirtualType=VM_MASTER
TIM2.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM2.IPParameters=Channel-PWM Generation1 CH1,Prescaler
TIM2.Prescaler=2
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
TIM3.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Pulse-PWM Generation1 CH1
TIM3.Prescaler=2
TIM3.Pulse-PWM\ Generation1\ CH1=32768
TIM4.IC2Filter=15
TIM4.IPParameters=IC2Filter,Prescaler
TIM4.Prescaler=0
@ -274,4 +280,6 @@ VP_SYS_VS_tim1.Mode=TIM1
VP_SYS_VS_tim1.Signal=SYS_VS_tim1
VP_TIM2_VS_ClockSourceINT.Mode=Internal
VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT
VP_TIM3_VS_ClockSourceINT.Mode=Internal
VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
board=custom

@ -0,0 +1,132 @@
Configuration BluepillTrouba
STM32CubeMX 6.5.0
Date 03/04/2023
MCU STM32F103CBTx
PERIPHERALS MODES FUNCTIONS PINS
ADC1 IN0 ADC1_IN0 PA0-WKUP
ADC1 IN1 ADC1_IN1 PA1
ADC1 Single-ended ADC1_TempSens_Input VP_ADC1_TempSens_Input
ADC1 Vrefint Channel ADC1_Vref_Input VP_ADC1_Vref_Input
RCC Crystal/Ceramic Resonator RCC_OSC_IN PD0-OSC_IN
RCC Crystal/Ceramic Resonator RCC_OSC_OUT PD1-OSC_OUT
RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN
RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT
RTC Activate Clock Source RTC_VS_RTC_Activate VP_RTC_VS_RTC_Activate
RTC No RTC Output RTC_No_RTC_Output VP_RTC_No_RTC_Output
SPI1 Transmit Only Master SPI1_MOSI PA7
SPI1 Transmit Only Master SPI1_SCK PA5
SYS Serial Wire SYS_JTCK-SWCLK PA14
SYS Serial Wire SYS_JTMS-SWDIO PA13
SYS TIM1 SYS_VS_tim1 VP_SYS_VS_tim1
TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT
TIM2 PWM Generation CH1 TIM2_CH1 PA15
TIM3 Internal Clock TIM3_VS_ClockSourceINT VP_TIM3_VS_ClockSourceINT
TIM3 PWM Generation CH1 TIM3_CH1 PA6
TIM4 Encoder Mode TIM4_CH1 PB6
TIM4 Encoder Mode TIM4_CH2 PB7
USART1 Asynchronous USART1_RX PA10
USART1 Asynchronous USART1_TX PA9
Pin Nb PINs FUNCTIONs LABELs
2 PC13-TAMPER-RTC GPIO_Output LED
3 PC14-OSC32_IN RCC_OSC32_IN
4 PC15-OSC32_OUT RCC_OSC32_OUT
5 PD0-OSC_IN RCC_OSC_IN
6 PD1-OSC_OUT RCC_OSC_OUT
10 PA0-WKUP ADC1_IN0 ADC_PT100
11 PA1 ADC1_IN1 ADC_SENSR
15 PA5 SPI1_SCK OLED_SCLK
16 PA6 TIM3_CH1 HEATER
17 PA7 SPI1_MOSI OLED_MOSI
18 PB0 GPIO_Output OLED_CS
19 PB1 GPIO_Output OLED_DC
21 PB10 GPIO_Output OLED_RST
30 PA9 USART1_TX
31 PA10 USART1_RX
34 PA13 SYS_JTMS-SWDIO
37 PA14 SYS_JTCK-SWCLK
38 PA15 TIM2_CH1 BUZZER
42 PB6 TIM4_CH1 KNOB_A
43 PB7 TIM4_CH2 KNOB_B
45 PB8 GPIO_Input KNOB_PUSH
PERIPHERALS MODES FUNCTIONS PINS
ADC1 IN0 ADC1_IN0 PA0-WKUP
ADC1 IN1 ADC1_IN1 PA1
ADC1 Single-ended ADC1_TempSens_Input VP_ADC1_TempSens_Input
ADC1 Vrefint Channel ADC1_Vref_Input VP_ADC1_Vref_Input
RCC Crystal/Ceramic Resonator RCC_OSC_IN PD0-OSC_IN
RCC Crystal/Ceramic Resonator RCC_OSC_OUT PD1-OSC_OUT
RCC Crystal/Ceramic Resonator RCC_OSC32_IN PC14-OSC32_IN
RCC Crystal/Ceramic Resonator RCC_OSC32_OUT PC15-OSC32_OUT
RTC Activate Clock Source RTC_VS_RTC_Activate VP_RTC_VS_RTC_Activate
RTC No RTC Output RTC_No_RTC_Output VP_RTC_No_RTC_Output
SPI1 Transmit Only Master SPI1_MOSI PA7
SPI1 Transmit Only Master SPI1_SCK PA5
SYS Serial Wire SYS_JTCK-SWCLK PA14
SYS Serial Wire SYS_JTMS-SWDIO PA13
SYS TIM1 SYS_VS_tim1 VP_SYS_VS_tim1
TIM2 Internal Clock TIM2_VS_ClockSourceINT VP_TIM2_VS_ClockSourceINT
TIM2 PWM Generation CH1 TIM2_CH1 PA15
TIM3 Internal Clock TIM3_VS_ClockSourceINT VP_TIM3_VS_ClockSourceINT
TIM3 PWM Generation CH1 TIM3_CH1 PA6
TIM4 Encoder Mode TIM4_CH1 PB6
TIM4 Encoder Mode TIM4_CH2 PB7
USART1 Asynchronous USART1_RX PA10
USART1 Asynchronous USART1_TX PA9
Pin Nb PINs FUNCTIONs LABELs
2 PC13-TAMPER-RTC GPIO_Output LED
3 PC14-OSC32_IN RCC_OSC32_IN
4 PC15-OSC32_OUT RCC_OSC32_OUT
5 PD0-OSC_IN RCC_OSC_IN
6 PD1-OSC_OUT RCC_OSC_OUT
10 PA0-WKUP ADC1_IN0 ADC_PT100
11 PA1 ADC1_IN1 ADC_SENSR
15 PA5 SPI1_SCK OLED_SCLK
16 PA6 TIM3_CH1 HEATER
17 PA7 SPI1_MOSI OLED_MOSI
18 PB0 GPIO_Output OLED_CS
19 PB1 GPIO_Output OLED_DC
21 PB10 GPIO_Output OLED_RST
30 PA9 USART1_TX
31 PA10 USART1_RX
34 PA13 SYS_JTMS-SWDIO
37 PA14 SYS_JTCK-SWCLK
38 PA15 TIM2_CH1 BUZZER
42 PB6 TIM4_CH1 KNOB_A
43 PB7 TIM4_CH2 KNOB_B
45 PB8 GPIO_Input KNOB_PUSH
SOFTWARE PROJECT
Project Settings :
Project Name : BluepillTrouba
Project Folder : /home/ondra/STM32Cube/BluepillTrouba
Toolchain / IDE : Makefile
Firmware Package Name and Version : STM32Cube FW_F1 V1.8.4
Code Generation Settings :
STM32Cube MCU packages and embedded software packs : Copy only the necessary library files
Generate peripheral initialization as a pair of '.c/.h' files per peripheral : Yes
Backup previously generated files when re-generating : No
Delete previously generated files when not re-generated : Yes
Set all free pins as analog (to optimize the power consumption) : No
Toolchains Settings :
Compiler Optimizations :

@ -63,26 +63,26 @@ void Error_Handler(void);
#define ADC_PT100_GPIO_Port GPIOA
#define ADC_SENSR_Pin GPIO_PIN_1
#define ADC_SENSR_GPIO_Port GPIOA
#define OLED_RST_Pin GPIO_PIN_3
#define OLED_RST_GPIO_Port GPIOA
#define OLED_DC_Pin GPIO_PIN_4
#define OLED_DC_GPIO_Port GPIOA
#define OLED_SCLK_Pin GPIO_PIN_5
#define OLED_SCLK_GPIO_Port GPIOA
#define OLED_CS_Pin GPIO_PIN_6
#define OLED_CS_GPIO_Port GPIOA
#define HEATER_Pin GPIO_PIN_6
#define HEATER_GPIO_Port GPIOA
#define OLED_MOSI_Pin GPIO_PIN_7
#define OLED_MOSI_GPIO_Port GPIOA
#define HEATER_Pin GPIO_PIN_11
#define HEATER_GPIO_Port GPIOB
#define OLED_CS_Pin GPIO_PIN_0
#define OLED_CS_GPIO_Port GPIOB
#define OLED_DC_Pin GPIO_PIN_1
#define OLED_DC_GPIO_Port GPIOB
#define OLED_RST_Pin GPIO_PIN_10
#define OLED_RST_GPIO_Port GPIOB
#define BUZZER_Pin GPIO_PIN_15
#define BUZZER_GPIO_Port GPIOA
#define KNOB_PUSH_Pin GPIO_PIN_5
#define KNOB_PUSH_GPIO_Port GPIOB
#define KNOB_B_Pin GPIO_PIN_6
#define KNOB_B_GPIO_Port GPIOB
#define KNOB_A_Pin GPIO_PIN_7
#define KNOB_A_Pin GPIO_PIN_6
#define KNOB_A_GPIO_Port GPIOB
#define KNOB_B_Pin GPIO_PIN_7
#define KNOB_B_GPIO_Port GPIOB
#define KNOB_PUSH_Pin GPIO_PIN_8
#define KNOB_PUSH_GPIO_Port GPIOB
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */

@ -34,6 +34,8 @@ extern "C" {
extern TIM_HandleTypeDef htim2;
extern TIM_HandleTypeDef htim3;
extern TIM_HandleTypeDef htim4;
/* USER CODE BEGIN Private defines */
@ -41,6 +43,7 @@ extern TIM_HandleTypeDef htim4;
/* USER CODE END Private defines */
void MX_TIM2_Init(void);
void MX_TIM3_Init(void);
void MX_TIM4_Init(void);
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);

@ -54,10 +54,7 @@ void MX_GPIO_Init(void)
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, OLED_RST_Pin|OLED_DC_Pin|OLED_CS_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(HEATER_GPIO_Port, HEATER_Pin, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, OLED_CS_Pin|OLED_DC_Pin|OLED_RST_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = LED_Pin;
@ -66,24 +63,17 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PAPin PAPin PAPin */
GPIO_InitStruct.Pin = OLED_RST_Pin|OLED_DC_Pin|OLED_CS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = HEATER_Pin;
/*Configure GPIO pins : PBPin PBPin PBPin */
GPIO_InitStruct.Pin = OLED_CS_Pin|OLED_DC_Pin|OLED_RST_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(HEATER_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = KNOB_PUSH_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(KNOB_PUSH_GPIO_Port, &GPIO_InitStruct);
}

@ -106,6 +106,7 @@ int main(void)
MX_TIM4_Init();
MX_TIM2_Init();
MX_RTC_Init();
MX_TIM3_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */

@ -25,6 +25,7 @@
/* USER CODE END 0 */
TIM_HandleTypeDef htim2;
TIM_HandleTypeDef htim3;
TIM_HandleTypeDef htim4;
/* TIM2 init function */
@ -80,6 +81,60 @@ void MX_TIM2_Init(void)
/* USER CODE END TIM2_Init 2 */
HAL_TIM_MspPostInit(&htim2);
}
/* TIM3 init function */
void MX_TIM3_Init(void)
{
/* USER CODE BEGIN TIM3_Init 0 */
/* USER CODE END TIM3_Init 0 */
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
TIM_MasterConfigTypeDef sMasterConfig = {0};
TIM_OC_InitTypeDef sConfigOC = {0};
/* USER CODE BEGIN TIM3_Init 1 */
/* USER CODE END TIM3_Init 1 */
htim3.Instance = TIM3;
htim3.Init.Prescaler = 2;
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
htim3.Init.Period = 65535;
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_Base_Init(&htim3) != HAL_OK)
{
Error_Handler();
}
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
if (HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig) != HAL_OK)
{
Error_Handler();
}
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 32768;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM3_Init 2 */
/* USER CODE END TIM3_Init 2 */
HAL_TIM_MspPostInit(&htim3);
}
/* TIM4 init function */
void MX_TIM4_Init(void)
@ -140,6 +195,17 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
/* USER CODE END TIM2_MspInit 1 */
}
else if(tim_baseHandle->Instance==TIM3)
{
/* USER CODE BEGIN TIM3_MspInit 0 */
/* USER CODE END TIM3_MspInit 0 */
/* TIM3 clock enable */
__HAL_RCC_TIM3_CLK_ENABLE();
/* USER CODE BEGIN TIM3_MspInit 1 */
/* USER CODE END TIM3_MspInit 1 */
}
}
void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* tim_encoderHandle)
@ -159,7 +225,7 @@ void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* tim_encoderHandle)
PB6 ------> TIM4_CH1
PB7 ------> TIM4_CH2
*/
GPIO_InitStruct.Pin = KNOB_B_Pin|KNOB_A_Pin;
GPIO_InitStruct.Pin = KNOB_A_Pin|KNOB_B_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
@ -181,7 +247,6 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
/* USER CODE BEGIN TIM2_MspPostInit 0 */
/* USER CODE END TIM2_MspPostInit 0 */
__HAL_RCC_GPIOA_CLK_ENABLE();
/**TIM2 GPIO Configuration
PA15 ------> TIM2_CH1
@ -197,6 +262,25 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
/* USER CODE END TIM2_MspPostInit 1 */
}
else if(timHandle->Instance==TIM3)
{
/* USER CODE BEGIN TIM3_MspPostInit 0 */
/* USER CODE END TIM3_MspPostInit 0 */
__HAL_RCC_GPIOA_CLK_ENABLE();
/**TIM3 GPIO Configuration
PA6 ------> TIM3_CH1
*/
GPIO_InitStruct.Pin = HEATER_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(HEATER_GPIO_Port, &GPIO_InitStruct);
/* USER CODE BEGIN TIM3_MspPostInit 1 */
/* USER CODE END TIM3_MspPostInit 1 */
}
}
@ -214,6 +298,17 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
/* USER CODE END TIM2_MspDeInit 1 */
}
else if(tim_baseHandle->Instance==TIM3)
{
/* USER CODE BEGIN TIM3_MspDeInit 0 */
/* USER CODE END TIM3_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_TIM3_CLK_DISABLE();
/* USER CODE BEGIN TIM3_MspDeInit 1 */
/* USER CODE END TIM3_MspDeInit 1 */
}
}
void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* tim_encoderHandle)
@ -231,7 +326,7 @@ void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* tim_encoderHandle)
PB6 ------> TIM4_CH1
PB7 ------> TIM4_CH2
*/
HAL_GPIO_DeInit(GPIOB, KNOB_B_Pin|KNOB_A_Pin);
HAL_GPIO_DeInit(GPIOB, KNOB_A_Pin|KNOB_B_Pin);
/* TIM4 interrupt Deinit */
HAL_NVIC_DisableIRQ(TIM4_IRQn);

@ -1,5 +1,5 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Thu Feb 23 00:46:03 CET 2023]
# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Sat Mar 04 11:28:52 CET 2023]
##########################################################################################################################
# ------------------------------------------------

Binary file not shown.
Loading…
Cancel
Save