PWM_Pin and PWM_Pin_STM32
This commit is contained in:
24
.mxproject
24
.mxproject
File diff suppressed because one or more lines are too long
@@ -85,6 +85,10 @@ void Error_Handler(void);
|
|||||||
#define SPI1_MISO_GPIO_Port GPIOA
|
#define SPI1_MISO_GPIO_Port GPIOA
|
||||||
#define SPI1_MOSI_Pin GPIO_PIN_7
|
#define SPI1_MOSI_Pin GPIO_PIN_7
|
||||||
#define SPI1_MOSI_GPIO_Port GPIOA
|
#define SPI1_MOSI_GPIO_Port GPIOA
|
||||||
|
#define DISPLAY_RESET_Pin GPIO_PIN_9
|
||||||
|
#define DISPLAY_RESET_GPIO_Port GPIOE
|
||||||
|
#define DISPLAY_DCRS_Pin GPIO_PIN_10
|
||||||
|
#define DISPLAY_DCRS_GPIO_Port GPIOE
|
||||||
#define DISPLAY_NSS_Pin GPIO_PIN_11
|
#define DISPLAY_NSS_Pin GPIO_PIN_11
|
||||||
#define DISPLAY_NSS_GPIO_Port GPIOE
|
#define DISPLAY_NSS_GPIO_Port GPIOE
|
||||||
#define CLK_IN_Pin GPIO_PIN_10
|
#define CLK_IN_Pin GPIO_PIN_10
|
||||||
|
|||||||
54
Core/Inc/tim.h
Normal file
54
Core/Inc/tim.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file tim.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the tim.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __TIM_H__
|
||||||
|
#define __TIM_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern TIM_HandleTypeDef htim10;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_TIM10_Init(void);
|
||||||
|
|
||||||
|
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __TIM_H__ */
|
||||||
|
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include "ILI9341.hpp"
|
#include "ILI9341.hpp"
|
||||||
|
|
||||||
ILI9341::ILI9341(SPI_Peripheral* hSpi, GPIO_Pin* hNssPin) :
|
ILI9341::ILI9341(SPI_Peripheral* hSpi, GPIO_Pin* hNssPin, GPIO_Pin* hResetPin, GPIO_Pin* hDcrsPin, PWM_Pin* hLedPwm) :
|
||||||
hSpi(hSpi), hNssPin(hNssPin) {
|
hSpi(hSpi), hNssPin(hNssPin), hResetPin(hResetPin), hDcrsPin(hDcrsPin), hLedPwm(hLedPwm) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +17,16 @@ ILI9341::~ILI9341() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t ILI9341::init() {
|
int32_t ILI9341::init() {
|
||||||
|
// Init pins
|
||||||
hNssPin->init();
|
hNssPin->init();
|
||||||
|
hResetPin->init();
|
||||||
|
hDcrsPin->init();
|
||||||
|
hLedPwm->init();
|
||||||
|
// Reset LCD
|
||||||
|
hResetPin->reset();
|
||||||
|
vTaskDelay(1);
|
||||||
|
hResetPin->set();
|
||||||
|
|
||||||
hSpi->take(100);
|
hSpi->take(100);
|
||||||
hNssPin->reset();
|
hNssPin->reset();
|
||||||
hSpi->transmit((uint8_t*)"Hello World", 11);
|
hSpi->transmit((uint8_t*)"Hello World", 11);
|
||||||
@@ -28,5 +37,15 @@ int32_t ILI9341::init() {
|
|||||||
hSpi->transmit((uint8_t*)"Hello World", 11);
|
hSpi->transmit((uint8_t*)"Hello World", 11);
|
||||||
hNssPin->set();
|
hNssPin->set();
|
||||||
hSpi->give();
|
hSpi->give();
|
||||||
|
while(true){
|
||||||
|
hLedPwm->setDuty(0.5);
|
||||||
|
vTaskDelay(1000);
|
||||||
|
hLedPwm->setDuty(1);
|
||||||
|
vTaskDelay(1000);
|
||||||
|
hLedPwm->setDuty(0.5);
|
||||||
|
vTaskDelay(1000);
|
||||||
|
hLedPwm->setDuty(0);
|
||||||
|
vTaskDelay(1000);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,17 +9,23 @@
|
|||||||
#define SRC_COMPONENTS_ILI9341_HPP_
|
#define SRC_COMPONENTS_ILI9341_HPP_
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include <task.h>
|
||||||
#include "SPI_Peripheral.hpp"
|
#include "SPI_Peripheral.hpp"
|
||||||
#include "GPIO_Pin.hpp"
|
#include "GPIO_Pin.hpp"
|
||||||
|
#include "PWM_Pin.hpp"
|
||||||
|
|
||||||
class ILI9341 {
|
class ILI9341 {
|
||||||
public:
|
public:
|
||||||
ILI9341(SPI_Peripheral* hSpi, GPIO_Pin* nssPin);
|
ILI9341(SPI_Peripheral* hSpi, GPIO_Pin* nssPin, GPIO_Pin* hResetPin, GPIO_Pin* hDcrsPin, PWM_Pin* hLedPwm);
|
||||||
virtual ~ILI9341();
|
virtual ~ILI9341();
|
||||||
int32_t init();
|
int32_t init();
|
||||||
private:
|
private:
|
||||||
SPI_Peripheral* hSpi;
|
SPI_Peripheral* hSpi;
|
||||||
GPIO_Pin* hNssPin;
|
GPIO_Pin* hNssPin;
|
||||||
|
GPIO_Pin* hResetPin;
|
||||||
|
GPIO_Pin* hDcrsPin;
|
||||||
|
PWM_Pin* hLedPwm;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SRC_COMPONENTS_ILI9341_HPP_ */
|
#endif /* SRC_COMPONENTS_ILI9341_HPP_ */
|
||||||
|
|||||||
20
Core/Src/Components/PWM_Pin.hpp
Normal file
20
Core/Src/Components/PWM_Pin.hpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* PWM_Pin.hpp
|
||||||
|
*
|
||||||
|
* Created on: Feb 11, 2024
|
||||||
|
* Author: Gabriel
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_COMPONENTS_PWM_PIN_HPP_
|
||||||
|
#define SRC_COMPONENTS_PWM_PIN_HPP_
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
class PWM_Pin {
|
||||||
|
public:
|
||||||
|
virtual int32_t init() = 0;
|
||||||
|
virtual int32_t setDuty(float dutyCycle) = 0;
|
||||||
|
virtual int32_t setFreq(float freq) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SRC_COMPONENTS_PWM_PIN_HPP_ */
|
||||||
40
Core/Src/Components/PWM_Pin_STM32.cpp
Normal file
40
Core/Src/Components/PWM_Pin_STM32.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* PWM_Pin_STM32.cpp
|
||||||
|
*
|
||||||
|
* Created on: Feb 11, 2024
|
||||||
|
* Author: Gabriel
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PWM_Pin_STM32.hpp"
|
||||||
|
|
||||||
|
PWM_Pin_STM32::PWM_Pin_STM32(TIM_HandleTypeDef* hTim, uint32_t channel) :
|
||||||
|
hTim(hTim), channel(channel){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PWM_Pin_STM32::~PWM_Pin_STM32() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t PWM_Pin_STM32::init() {
|
||||||
|
if(HAL_TIM_PWM_Start(hTim, channel) == HAL_OK){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t PWM_Pin_STM32::setDuty(float dutyCycle) {
|
||||||
|
if(dutyCycle<0 || dutyCycle>1){
|
||||||
|
// Invalid parameter
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
uint32_t ccr = dutyCycle*__HAL_TIM_GET_AUTORELOAD(hTim);
|
||||||
|
__HAL_TIM_SET_COMPARE(hTim, channel, ccr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t PWM_Pin_STM32::setFreq(float freq) {
|
||||||
|
// TODO Implement this function
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
26
Core/Src/Components/PWM_Pin_STM32.hpp
Normal file
26
Core/Src/Components/PWM_Pin_STM32.hpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* PWM_Pin_STM32.hpp
|
||||||
|
*
|
||||||
|
* Created on: Feb 11, 2024
|
||||||
|
* Author: Gabriel
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_COMPONENTS_PWM_PIN_STM32_HPP_
|
||||||
|
#define SRC_COMPONENTS_PWM_PIN_STM32_HPP_
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "PWM_Pin.hpp"
|
||||||
|
|
||||||
|
class PWM_Pin_STM32 : public PWM_Pin {
|
||||||
|
public:
|
||||||
|
PWM_Pin_STM32(TIM_HandleTypeDef* hTim, uint32_t channel);
|
||||||
|
virtual ~PWM_Pin_STM32();
|
||||||
|
int32_t init();
|
||||||
|
int32_t setDuty(float dutyCycle);
|
||||||
|
int32_t setFreq(float freq);
|
||||||
|
private:
|
||||||
|
TIM_HandleTypeDef* hTim;
|
||||||
|
uint32_t channel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SRC_COMPONENTS_PWM_PIN_STM32_HPP_ */
|
||||||
@@ -8,10 +8,12 @@
|
|||||||
#include "start.hpp"
|
#include "start.hpp"
|
||||||
#include "GPIO_Pin_STM32.hpp"
|
#include "GPIO_Pin_STM32.hpp"
|
||||||
#include "SPI_Peripheral_STM32.hpp"
|
#include "SPI_Peripheral_STM32.hpp"
|
||||||
|
#include "PWM_Pin_STM32.hpp"
|
||||||
#include "BinLeds.hpp"
|
#include "BinLeds.hpp"
|
||||||
#include "ILI9341.hpp"
|
#include "ILI9341.hpp"
|
||||||
|
|
||||||
extern SPI_HandleTypeDef hspi5;
|
extern SPI_HandleTypeDef hspi5;
|
||||||
|
extern TIM_HandleTypeDef htim10;
|
||||||
|
|
||||||
GPIO_Pin_STM32 ledOrange(LD3_GPIO_Port, LD3_Pin);
|
GPIO_Pin_STM32 ledOrange(LD3_GPIO_Port, LD3_Pin);
|
||||||
GPIO_Pin_STM32 ledGreen(LD4_GPIO_Port, LD4_Pin);
|
GPIO_Pin_STM32 ledGreen(LD4_GPIO_Port, LD4_Pin);
|
||||||
@@ -22,7 +24,10 @@ BinLeds discoveryLeds((GPIO_Pin*[]){&ledOrange, &ledGreen, &ledRed, &ledBlue}, 4
|
|||||||
|
|
||||||
SPI_Peripheral_STM32 spi_a(&hspi5, 100);
|
SPI_Peripheral_STM32 spi_a(&hspi5, 100);
|
||||||
GPIO_Pin_STM32 displayNss(DISPLAY_NSS_GPIO_Port, DISPLAY_NSS_Pin);
|
GPIO_Pin_STM32 displayNss(DISPLAY_NSS_GPIO_Port, DISPLAY_NSS_Pin);
|
||||||
ILI9341 display(&spi_a, &displayNss);
|
GPIO_Pin_STM32 displayReset(DISPLAY_RESET_GPIO_Port, DISPLAY_RESET_Pin);
|
||||||
|
GPIO_Pin_STM32 displayDcrs(DISPLAY_DCRS_GPIO_Port, DISPLAY_DCRS_Pin);
|
||||||
|
PWM_Pin_STM32 displayLed(&htim10, TIM_CHANNEL_1);
|
||||||
|
ILI9341 display(&spi_a, &displayNss, &displayReset, &displayDcrs, &displayLed);
|
||||||
|
|
||||||
void start(){
|
void start(){
|
||||||
spi_a.init();
|
spi_a.init();
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ void MX_GPIO_Init(void)
|
|||||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(CS_I2C_SPI_GPIO_Port, CS_I2C_SPI_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(GPIOE, CS_I2C_SPI_Pin|DISPLAY_DCRS_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(DISPLAY_NSS_GPIO_Port, DISPLAY_NSS_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOE, DISPLAY_RESET_Pin|DISPLAY_NSS_Pin, GPIO_PIN_SET);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOD, LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin
|
HAL_GPIO_WritePin(GPIOD, LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin
|
||||||
@@ -75,8 +75,8 @@ void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
HAL_GPIO_Init(DATA_Ready_GPIO_Port, &GPIO_InitStruct);
|
HAL_GPIO_Init(DATA_Ready_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pins : PEPin PEPin */
|
/*Configure GPIO pins : PEPin PEPin PEPin PEPin */
|
||||||
GPIO_InitStruct.Pin = CS_I2C_SPI_Pin|DISPLAY_NSS_Pin;
|
GPIO_InitStruct.Pin = CS_I2C_SPI_Pin|DISPLAY_RESET_Pin|DISPLAY_DCRS_Pin|DISPLAY_NSS_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "i2s.h"
|
#include "i2s.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "tim.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
@@ -101,6 +102,7 @@ int main(void)
|
|||||||
MX_I2S3_Init();
|
MX_I2S3_Init();
|
||||||
MX_SPI1_Init();
|
MX_SPI1_Init();
|
||||||
MX_SPI5_Init();
|
MX_SPI5_Init();
|
||||||
|
MX_TIM10_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
|
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
|
|||||||
132
Core/Src/tim.c
Normal file
132
Core/Src/tim.c
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file tim.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the TIM instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
TIM_HandleTypeDef htim10;
|
||||||
|
|
||||||
|
/* TIM10 init function */
|
||||||
|
void MX_TIM10_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM10_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_Init 0 */
|
||||||
|
|
||||||
|
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM10_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_Init 1 */
|
||||||
|
htim10.Instance = TIM10;
|
||||||
|
htim10.Init.Prescaler = 0;
|
||||||
|
htim10.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
|
htim10.Init.Period = 65535;
|
||||||
|
htim10.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
|
htim10.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||||
|
if (HAL_TIM_Base_Init(&htim10) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_TIM_PWM_Init(&htim10) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||||
|
sConfigOC.Pulse = 0;
|
||||||
|
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||||
|
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||||
|
if (HAL_TIM_PWM_ConfigChannel(&htim10, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN TIM10_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_Init 2 */
|
||||||
|
HAL_TIM_MspPostInit(&htim10);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(tim_baseHandle->Instance==TIM10)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM10_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_MspInit 0 */
|
||||||
|
/* TIM10 clock enable */
|
||||||
|
__HAL_RCC_TIM10_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN TIM10_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(timHandle->Instance==TIM10)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM10_MspPostInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_MspPostInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**TIM10 GPIO Configuration
|
||||||
|
PB8 ------> TIM10_CH1
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_8;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF3_TIM10;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM10_MspPostInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_MspPostInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(tim_baseHandle->Instance==TIM10)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM10_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_TIM10_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN TIM10_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM10_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
4096
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h
Normal file
4096
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -50,6 +50,7 @@ Mcu.CPN=STM32F411VET6
|
|||||||
Mcu.Family=STM32F4
|
Mcu.Family=STM32F4
|
||||||
Mcu.IP0=DMA
|
Mcu.IP0=DMA
|
||||||
Mcu.IP1=FREERTOS
|
Mcu.IP1=FREERTOS
|
||||||
|
Mcu.IP10=TIM10
|
||||||
Mcu.IP2=I2C1
|
Mcu.IP2=I2C1
|
||||||
Mcu.IP3=I2S2
|
Mcu.IP3=I2S2
|
||||||
Mcu.IP4=I2S3
|
Mcu.IP4=I2S3
|
||||||
@@ -58,7 +59,7 @@ Mcu.IP6=RCC
|
|||||||
Mcu.IP7=SPI1
|
Mcu.IP7=SPI1
|
||||||
Mcu.IP8=SPI5
|
Mcu.IP8=SPI5
|
||||||
Mcu.IP9=SYS
|
Mcu.IP9=SYS
|
||||||
Mcu.IPNb=10
|
Mcu.IPNb=11
|
||||||
Mcu.Name=STM32F411V(C-E)Tx
|
Mcu.Name=STM32F411V(C-E)Tx
|
||||||
Mcu.Package=LQFP100
|
Mcu.Package=LQFP100
|
||||||
Mcu.Pin0=PE2
|
Mcu.Pin0=PE2
|
||||||
@@ -69,42 +70,46 @@ Mcu.Pin12=PA4
|
|||||||
Mcu.Pin13=PA5
|
Mcu.Pin13=PA5
|
||||||
Mcu.Pin14=PA6
|
Mcu.Pin14=PA6
|
||||||
Mcu.Pin15=PA7
|
Mcu.Pin15=PA7
|
||||||
Mcu.Pin16=PE11
|
Mcu.Pin16=PE9
|
||||||
Mcu.Pin17=PE12
|
Mcu.Pin17=PE10
|
||||||
Mcu.Pin18=PE13
|
Mcu.Pin18=PE11
|
||||||
Mcu.Pin19=PE14
|
Mcu.Pin19=PE12
|
||||||
Mcu.Pin2=PE4
|
Mcu.Pin2=PE4
|
||||||
Mcu.Pin20=PB10
|
Mcu.Pin20=PE13
|
||||||
Mcu.Pin21=PB12
|
Mcu.Pin21=PE14
|
||||||
Mcu.Pin22=PD12
|
Mcu.Pin22=PB10
|
||||||
Mcu.Pin23=PD13
|
Mcu.Pin23=PB12
|
||||||
Mcu.Pin24=PD14
|
Mcu.Pin24=PD12
|
||||||
Mcu.Pin25=PD15
|
Mcu.Pin25=PD13
|
||||||
Mcu.Pin26=PC7
|
Mcu.Pin26=PD14
|
||||||
Mcu.Pin27=PA9
|
Mcu.Pin27=PD15
|
||||||
Mcu.Pin28=PA10
|
Mcu.Pin28=PC7
|
||||||
Mcu.Pin29=PA11
|
Mcu.Pin29=PA9
|
||||||
Mcu.Pin3=PE5
|
Mcu.Pin3=PE5
|
||||||
Mcu.Pin30=PA12
|
Mcu.Pin30=PA10
|
||||||
Mcu.Pin31=PA13
|
Mcu.Pin31=PA11
|
||||||
Mcu.Pin32=PA14
|
Mcu.Pin32=PA12
|
||||||
Mcu.Pin33=PC10
|
Mcu.Pin33=PA13
|
||||||
Mcu.Pin34=PC12
|
Mcu.Pin34=PA14
|
||||||
Mcu.Pin35=PD4
|
Mcu.Pin35=PC10
|
||||||
Mcu.Pin36=PD5
|
Mcu.Pin36=PC12
|
||||||
Mcu.Pin37=PB3
|
Mcu.Pin37=PD4
|
||||||
Mcu.Pin38=PB6
|
Mcu.Pin38=PD5
|
||||||
Mcu.Pin39=PB9
|
Mcu.Pin39=PB3
|
||||||
Mcu.Pin4=PC14-OSC32_IN
|
Mcu.Pin4=PC14-OSC32_IN
|
||||||
Mcu.Pin40=PE1
|
Mcu.Pin40=PB6
|
||||||
Mcu.Pin41=VP_FREERTOS_VS_CMSIS_V2
|
Mcu.Pin41=PB8
|
||||||
Mcu.Pin42=VP_SYS_VS_tim11
|
Mcu.Pin42=PB9
|
||||||
|
Mcu.Pin43=PE1
|
||||||
|
Mcu.Pin44=VP_FREERTOS_VS_CMSIS_V2
|
||||||
|
Mcu.Pin45=VP_SYS_VS_tim11
|
||||||
|
Mcu.Pin46=VP_TIM10_VS_ClockSourceINT
|
||||||
Mcu.Pin5=PC15-OSC32_OUT
|
Mcu.Pin5=PC15-OSC32_OUT
|
||||||
Mcu.Pin6=PH0 - OSC_IN
|
Mcu.Pin6=PH0 - OSC_IN
|
||||||
Mcu.Pin7=PH1 - OSC_OUT
|
Mcu.Pin7=PH1 - OSC_OUT
|
||||||
Mcu.Pin8=PC0
|
Mcu.Pin8=PC0
|
||||||
Mcu.Pin9=PC2
|
Mcu.Pin9=PC2
|
||||||
Mcu.PinsNb=43
|
Mcu.PinsNb=47
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F411VETx
|
Mcu.UserName=STM32F411VETx
|
||||||
@@ -204,6 +209,7 @@ PB6.GPIO_Speed=GPIO_SPEED_FREQ_LOW
|
|||||||
PB6.Locked=true
|
PB6.Locked=true
|
||||||
PB6.Mode=I2C
|
PB6.Mode=I2C
|
||||||
PB6.Signal=I2C1_SCL
|
PB6.Signal=I2C1_SCL
|
||||||
|
PB8.Signal=S_TIM10_CH1
|
||||||
PB9.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Pu,GPIO_Mode
|
PB9.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Pu,GPIO_Mode
|
||||||
PB9.GPIO_Label=Audio_SDA [CS43L22_SDA]
|
PB9.GPIO_Label=Audio_SDA [CS43L22_SDA]
|
||||||
PB9.GPIO_Mode=GPIO_MODE_AF_OD
|
PB9.GPIO_Mode=GPIO_MODE_AF_OD
|
||||||
@@ -296,6 +302,10 @@ PE1.GPIO_Label=MEMS_INT2 [L3GD20_INT2]
|
|||||||
PE1.GPIO_ModeDefaultEXTI=GPIO_MODE_EVT_RISING
|
PE1.GPIO_ModeDefaultEXTI=GPIO_MODE_EVT_RISING
|
||||||
PE1.Locked=true
|
PE1.Locked=true
|
||||||
PE1.Signal=GPXTI1
|
PE1.Signal=GPXTI1
|
||||||
|
PE10.GPIOParameters=GPIO_Label
|
||||||
|
PE10.GPIO_Label=DISPLAY_DCRS
|
||||||
|
PE10.Locked=true
|
||||||
|
PE10.Signal=GPIO_Output
|
||||||
PE11.GPIOParameters=PinState,GPIO_Label
|
PE11.GPIOParameters=PinState,GPIO_Label
|
||||||
PE11.GPIO_Label=DISPLAY_NSS
|
PE11.GPIO_Label=DISPLAY_NSS
|
||||||
PE11.Locked=true
|
PE11.Locked=true
|
||||||
@@ -331,6 +341,11 @@ PE5.GPIO_Label=INT2 [LSM303DLHC_INT2]
|
|||||||
PE5.GPIO_ModeDefaultEXTI=GPIO_MODE_EVT_RISING
|
PE5.GPIO_ModeDefaultEXTI=GPIO_MODE_EVT_RISING
|
||||||
PE5.Locked=true
|
PE5.Locked=true
|
||||||
PE5.Signal=GPXTI5
|
PE5.Signal=GPXTI5
|
||||||
|
PE9.GPIOParameters=PinState,GPIO_Label
|
||||||
|
PE9.GPIO_Label=DISPLAY_RESET
|
||||||
|
PE9.Locked=true
|
||||||
|
PE9.PinState=GPIO_PIN_SET
|
||||||
|
PE9.Signal=GPIO_Output
|
||||||
PH0\ -\ OSC_IN.GPIOParameters=GPIO_Label
|
PH0\ -\ OSC_IN.GPIOParameters=GPIO_Label
|
||||||
PH0\ -\ OSC_IN.GPIO_Label=PH0-OSC_IN
|
PH0\ -\ OSC_IN.GPIO_Label=PH0-OSC_IN
|
||||||
PH0\ -\ OSC_IN.Locked=true
|
PH0\ -\ OSC_IN.Locked=true
|
||||||
@@ -372,7 +387,7 @@ ProjectManager.ToolChainLocation=
|
|||||||
ProjectManager.UAScriptAfterPath=
|
ProjectManager.UAScriptAfterPath=
|
||||||
ProjectManager.UAScriptBeforePath=
|
ProjectManager.UAScriptBeforePath=
|
||||||
ProjectManager.UnderRoot=true
|
ProjectManager.UnderRoot=true
|
||||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_I2S2_Init-I2S2-false-HAL-true,6-MX_I2S3_Init-I2S3-false-HAL-true,7-MX_SPI1_Init-SPI1-false-HAL-true,8-MX_SPI5_Init-SPI5-false-HAL-true
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_I2C1_Init-I2C1-false-HAL-true,5-MX_I2S2_Init-I2S2-false-HAL-true,6-MX_I2S3_Init-I2S3-false-HAL-true,7-MX_SPI1_Init-SPI1-false-HAL-true,8-MX_SPI5_Init-SPI5-false-HAL-true,9-MX_TIM10_Init-TIM10-false-HAL-true
|
||||||
RCC.48MHZClocksFreq_Value=48000000
|
RCC.48MHZClocksFreq_Value=48000000
|
||||||
RCC.AHBFreq_Value=96000000
|
RCC.AHBFreq_Value=96000000
|
||||||
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||||
@@ -416,6 +431,8 @@ SH.GPXTI4.0=GPIO_EXTI4
|
|||||||
SH.GPXTI4.ConfNb=1
|
SH.GPXTI4.ConfNb=1
|
||||||
SH.GPXTI5.0=GPIO_EXTI5
|
SH.GPXTI5.0=GPIO_EXTI5
|
||||||
SH.GPXTI5.ConfNb=1
|
SH.GPXTI5.ConfNb=1
|
||||||
|
SH.S_TIM10_CH1.0=TIM10_CH1,PWM Generation1 CH1
|
||||||
|
SH.S_TIM10_CH1.ConfNb=1
|
||||||
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2
|
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2
|
||||||
SPI1.CalculateBaudRate=48.0 MBits/s
|
SPI1.CalculateBaudRate=48.0 MBits/s
|
||||||
SPI1.Direction=SPI_DIRECTION_2LINES
|
SPI1.Direction=SPI_DIRECTION_2LINES
|
||||||
@@ -428,10 +445,14 @@ SPI5.Direction=SPI_DIRECTION_2LINES
|
|||||||
SPI5.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler
|
SPI5.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,BaudRatePrescaler
|
||||||
SPI5.Mode=SPI_MODE_MASTER
|
SPI5.Mode=SPI_MODE_MASTER
|
||||||
SPI5.VirtualType=VM_MASTER
|
SPI5.VirtualType=VM_MASTER
|
||||||
|
TIM10.Channel=TIM_CHANNEL_1
|
||||||
|
TIM10.IPParameters=Channel
|
||||||
VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
|
VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2
|
||||||
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
|
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2
|
||||||
VP_SYS_VS_tim11.Mode=TIM11
|
VP_SYS_VS_tim11.Mode=TIM11
|
||||||
VP_SYS_VS_tim11.Signal=SYS_VS_tim11
|
VP_SYS_VS_tim11.Signal=SYS_VS_tim11
|
||||||
|
VP_TIM10_VS_ClockSourceINT.Mode=Enable_Timer
|
||||||
|
VP_TIM10_VS_ClockSourceINT.Signal=TIM10_VS_ClockSourceINT
|
||||||
board=STM32F411E-DISCO
|
board=STM32F411E-DISCO
|
||||||
boardIOC=true
|
boardIOC=true
|
||||||
isbadioc=false
|
isbadioc=false
|
||||||
|
|||||||
Reference in New Issue
Block a user