Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ Usage: scons mode=<MODE> mcu=<MCU> (hse=<HSE> / hsi=<HSI>) [float=hard] [example
f1md = STM32100 medium density series.
f1mdvl = STM32100 medium density value line series.
f4 = STM32F407/f417 series (maintained for backwards compatibility)
f401 = STM32F401
f405 = STM32F405
f407 = STM32F407
f411 = STM32F411
f415 = STM32F417
f417 = STM32F417
f427 = STM32F427
Expand Down Expand Up @@ -184,9 +186,15 @@ elif mcu=="f1md":
elif mcu=="f4" or mcu=="f407":
setFlags("m4","F407")
floatOpt()
elif mcu=="f401":
setFlags("m4","F401")
floatOpt()
elif mcu=="f405":
setFlags("m4","F405")
floatOpt()
elif mcu=="f411":
setFlags("m4","F411")
floatOpt()
elif mcu=="f415":
setFlags("m4","F415")
floatOpt()
Expand Down
4 changes: 1 addition & 3 deletions lib/fwlib/f4/stdperiph/inc/stm32f4xx_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,7 @@ typedef struct

#if defined (STM32F40_41xxx)
#define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_16)
#endif /* STM32F40_41xxx */

#if defined (STM32F427_437xx) || defined (STM32F429_439xx) || defined (STM32F401xx) || defined (STM32F411xE)
#elif defined (STM32F427_437xx) || defined (STM32F429_439xx) || defined (STM32F401xx) || defined (STM32F411xE)
#define ADC_Channel_TempSensor ((uint8_t)ADC_Channel_18)
#endif /* STM32F427_437xx || STM32F429_439xx || STM32F401xx || STM32F411xE */

Expand Down
4 changes: 4 additions & 0 deletions lib/fwlib/f4/stdperiph/inc/stm32f4xx_dac.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
/* Includes ------------------------------------------------------------------*/
#include "fwlib/f4/cmsis/Device/ST/STM32F4xx/Include/stm32f4xx.h"

#if defined(STM32PLUS_F4_HAS_DCMI)

/** @addtogroup STM32F4xx_StdPeriph_Driver
* @{
*/
Expand Down Expand Up @@ -287,6 +289,8 @@ void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG);
ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT);
void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT);

#endif

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 4 additions & 0 deletions lib/fwlib/f4/stdperiph/inc/stm32f4xx_rng.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
/* Includes ------------------------------------------------------------------*/
#include "fwlib/f4/cmsis/Device/ST/STM32F4xx/Include/stm32f4xx.h"

#if defined(STM32PLUS_F4_HAS_RNG)

/** @addtogroup STM32F4xx_StdPeriph_Driver
* @{
*/
Expand Down Expand Up @@ -103,6 +105,8 @@ void RNG_ClearFlag(uint8_t RNG_FLAG);
ITStatus RNG_GetITStatus(uint8_t RNG_IT);
void RNG_ClearITPendingBit(uint8_t RNG_IT);

#endif

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 4 additions & 0 deletions lib/fwlib/f4/stdperiph/src/stm32f4xx_dac.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@
#include "fwlib/f4/stdperiph/inc/stm32f4xx_dac.h"
#include "fwlib/f4/stdperiph/inc/stm32f4xx_rcc.h"

#if defined(STM32PLUS_F4_HAS_DCMI)

/** @addtogroup STM32F4xx_StdPeriph_Driver
* @{
*/
Expand Down Expand Up @@ -712,3 +714,5 @@ void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT)
*/

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

#endif
5 changes: 3 additions & 2 deletions lib/fwlib/f4/stdperiph/src/stm32f4xx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void GPIO_DeInit(GPIO_TypeDef* GPIOx)
RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOE, ENABLE);
RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOE, DISABLE);
}
#if defined (STM32PLUS_F4_HAS_GPIOF_G_I)
else if (GPIOx == GPIOF)
{
RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOF, ENABLE);
Expand All @@ -175,9 +176,9 @@ void GPIO_DeInit(GPIO_TypeDef* GPIOx)
RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOI, ENABLE);
RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOI, DISABLE);
}
#endif

#if defined(STM32PLUS_F427) || defined(STM32PLUS_F429) || defined(STM32PLUS_F437) || defined(STM32PLUS_F439)

#if defined(STM32PLUS_F4_HAS_GPIOJ_K)
else if (GPIOx == GPIOJ)
{
RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_GPIOJ, ENABLE);
Expand Down
5 changes: 4 additions & 1 deletion lib/fwlib/f4/stdperiph/src/stm32f4xx_rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
#include "fwlib/f4/stdperiph/inc/stm32f4xx_rng.h"
#include "fwlib/f4/stdperiph/inc/stm32f4xx_rcc.h"

#if defined(STM32PLUS_F4_HAS_RNG)

/** @addtogroup STM32F4xx_StdPeriph_Driver
* @{
*/
Expand Down Expand Up @@ -393,5 +395,6 @@ void RNG_ClearITPendingBit(uint8_t RNG_IT)
* @}
*/


/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

#endif
48 changes: 39 additions & 9 deletions lib/fwlib/f4/stdperiph/src/stm32f4xx_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void TIM_DeInit(TIM_TypeDef* TIMx)
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM5, DISABLE);
}
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
else if (TIMx == TIM6)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM6, ENABLE);
Expand All @@ -242,6 +243,7 @@ void TIM_DeInit(TIM_TypeDef* TIMx)
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM8, DISABLE);
}
#endif
else if (TIMx == TIM9)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM9, ENABLE);
Expand All @@ -257,6 +259,7 @@ void TIM_DeInit(TIM_TypeDef* TIMx)
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM11, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_TIM11, DISABLE);
}
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
else if (TIMx == TIM12)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM12, ENABLE);
Expand All @@ -275,6 +278,7 @@ void TIM_DeInit(TIM_TypeDef* TIMx)
RCC_APB1PeriphResetCmd(RCC_APB1Periph_TIM14, DISABLE);
}
}
#endif
}

/**
Expand All @@ -296,21 +300,27 @@ void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseIn

tmpcr1 = TIMx->CR1;

if((TIMx == TIM1) || (TIMx == TIM8)||
(TIMx == TIM2) || (TIMx == TIM3)||
(TIMx == TIM4) || (TIMx == TIM5))
if((TIMx == TIM1) || (TIMx == TIM2) ||
(TIMx == TIM3) || (TIMx == TIM4) ||
(TIMx == TIM5)
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
|| (TIMx == TIM8)
#endif
)
{
/* Select the Counter Mode */
tmpcr1 &= (uint16_t)(~(TIM_CR1_DIR | TIM_CR1_CMS));
tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_CounterMode;
}

#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
if((TIMx != TIM6) && (TIMx != TIM7))
{
/* Set the clock division */
tmpcr1 &= (uint16_t)(~TIM_CR1_CKD);
tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_ClockDivision;
}
#endif

TIMx->CR1 = tmpcr1;

Expand All @@ -320,8 +330,12 @@ void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseIn
/* Set the Prescaler value */
TIMx->PSC = TIM_TimeBaseInitStruct->TIM_Prescaler;

if ((TIMx == TIM1) || (TIMx == TIM8))
{
if ((TIMx == TIM1)
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
|| (TIMx == TIM8)
#endif
)
{
/* Set the Repetition Counter value */
TIMx->RCR = TIM_TimeBaseInitStruct->TIM_RepetitionCounter;
}
Expand Down Expand Up @@ -705,7 +719,11 @@ void TIM_OC1Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct)
/* Set the Output State */
tmpccer |= TIM_OCInitStruct->TIM_OutputState;

if((TIMx == TIM1) || (TIMx == TIM8))
if((TIMx == TIM1)
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
|| (TIMx == TIM8)
#endif
)
{
assert_param(IS_TIM_OUTPUTN_STATE(TIM_OCInitStruct->TIM_OutputNState));
assert_param(IS_TIM_OCN_POLARITY(TIM_OCInitStruct->TIM_OCNPolarity));
Expand Down Expand Up @@ -787,7 +805,11 @@ void TIM_OC2Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct)
/* Set the Output State */
tmpccer |= (uint16_t)(TIM_OCInitStruct->TIM_OutputState << 4);

if((TIMx == TIM1) || (TIMx == TIM8))
if((TIMx == TIM1)
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
|| (TIMx == TIM8)
#endif
)
{
assert_param(IS_TIM_OUTPUTN_STATE(TIM_OCInitStruct->TIM_OutputNState));
assert_param(IS_TIM_OCN_POLARITY(TIM_OCInitStruct->TIM_OCNPolarity));
Expand Down Expand Up @@ -867,7 +889,11 @@ void TIM_OC3Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct)
/* Set the Output State */
tmpccer |= (uint16_t)(TIM_OCInitStruct->TIM_OutputState << 8);

if((TIMx == TIM1) || (TIMx == TIM8))
if((TIMx == TIM1)
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
|| (TIMx == TIM8)
#endif
)
{
assert_param(IS_TIM_OUTPUTN_STATE(TIM_OCInitStruct->TIM_OutputNState));
assert_param(IS_TIM_OCN_POLARITY(TIM_OCInitStruct->TIM_OCNPolarity));
Expand Down Expand Up @@ -948,7 +974,11 @@ void TIM_OC4Init(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct)
/* Set the Output State */
tmpccer |= (uint16_t)(TIM_OCInitStruct->TIM_OutputState << 12);

if((TIMx == TIM1) || (TIMx == TIM8))
if((TIMx == TIM1)
#if defined (STM32PLUS_F4_HAS_TIM6_7_8_12_13_14)
|| (TIMx == TIM8)
#endif
)
{
assert_param(IS_TIM_OCIDLE_STATE(TIM_OCInitStruct->TIM_OCIdleState));
/* Reset the Output Compare IDLE State */
Expand Down
2 changes: 2 additions & 0 deletions lib/fwlib/f4/stdperiph/src/stm32f4xx_usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ void USART_DeInit(USART_TypeDef* USARTx)
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE);
}
#if defined(STM32PLUS_F4_HAS_USART3_4_5)
else if (USARTx == USART3)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, ENABLE);
Expand All @@ -214,6 +215,7 @@ void USART_DeInit(USART_TypeDef* USARTx)
RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_UART5, DISABLE);
}
#endif
else if (USARTx == USART6)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART6, ENABLE);
Expand Down
3 changes: 2 additions & 1 deletion lib/include/adc/features/f4/AdcChannelGpioInitialiser.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace stm32plus {
case 15: port=GPIOC; pin=GPIO_Pin_5; break;
}
}
#if defined(STM32PLUS_F4_HAS_ADC2_3)
else if(TAdcNumber==2) {
switch(TChannelNumber) {
case 0: port=GPIOA; pin=GPIO_Pin_0; break;
Expand Down Expand Up @@ -97,7 +98,7 @@ namespace stm32plus {
case 15: port=GPIOF; pin=GPIO_Pin_5; break;
}
}

#endif
// initialise the pin

GpioPinInitialiser::initialise(port,pin); // this minimal overload is for analog input
Expand Down
2 changes: 2 additions & 0 deletions lib/include/config/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@
#include "adc/f4/Adc.h"
#include "adc/f4/AdcPeripheral.h"
#include "adc/Adc1.h"
#if defined(STM32PLUS_F4_HAS_ADC2_3)
#include "adc/Adc2.h"
#include "adc/Adc3.h"
#endif

#endif

Expand Down
8 changes: 5 additions & 3 deletions lib/include/config/dac.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@

// peripheral includes

#include "dac/Dac.h"
#include "dac/DacPinInitialiser.h"
#include "dac/DacPeripheral.h"
#if defined(STM32PLUS_F4_HAS_DAC)
#include "dac/Dac.h"
#include "dac/DacPinInitialiser.h"
#include "dac/DacPeripheral.h"
#endif

// feature includes

Expand Down
19 changes: 19 additions & 0 deletions lib/include/config/mcu_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
#elif defined(STM32PLUS_F0_42)
#define STM32PLUS_F0
#define STM32F0XX

#elif defined(STM32PLUS_F401)
#define STM32PLUS_F4
#define STM32F401xx
#define STM32F401xC
#define STM32F401xE

#elif defined(STM32PLUS_F405)
#define STM32PLUS_F4
#define STM32F405xx
Expand All @@ -54,6 +61,7 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FSMC
#define STM32PLUS_F4_HAS_RNG

#elif defined(STM32PLUS_F407)
#define STM32PLUS_F4
Expand All @@ -69,6 +77,11 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FSMC
#define STM32PLUS_F4_HAS_RNG

#elif defined(STM32PLUS_F411)
#define STM32PLUS_F4
#define STM32F411xE

#elif defined(STM32PLUS_F415)
#define STM32PLUS_F4
Expand All @@ -83,6 +96,7 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FSMC
#define STM32PLUS_F4_HAS_RNG

#elif defined(STM32PLUS_F417)
#define STM32PLUS_F4
Expand All @@ -99,6 +113,7 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FSMC
#define STM32PLUS_F4_HAS_RNG

#elif defined(STM32PLUS_F427)
#define STM32PLUS_F4
Expand All @@ -117,6 +132,7 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FMC
#define STM32PLUS_F4_HAS_RNG

#elif defined(STM32PLUS_F429)
#define STM32PLUS_F4
Expand All @@ -136,6 +152,7 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FMC
#define STM32PLUS_F4_HAS_RNG

#elif defined(STM32PLUS_F437)
#define STM32PLUS_F4
Expand All @@ -155,6 +172,7 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FMC
#define STM32PLUS_F4_HAS_RNG

#elif defined(STM32PLUS_F439)
#define STM32PLUS_F4
Expand All @@ -175,6 +193,7 @@
#define STM32PLUS_F4_HAS_OTG_HS
#define STM32PLUS_F4_HAS_DAC
#define STM32PLUS_F4_HAS_FMC
#define STM32PLUS_F4_HAS_RNG

#else
#error "You must define an MCU type. See config/stm32plus.h"
Expand Down
Loading