Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MFS_ADC MFS-7_Segment-Interrupt MFS_USART_Test_HAL MFS_02-Luftschlange ... more
Revision 11:64f579b3fd14, committed 2021-03-12
- Comitter:
- jack1930
- Date:
- Fri Mar 12 10:03:30 2021 +0000
- Parent:
- 10:dcfa32556a25
- Commit message:
- L152+F411+F103
Changed in this revision
| MFS.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MFS.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MFS.cpp Fri Mar 12 08:36:07 2021 +0000
+++ b/MFS.cpp Fri Mar 12 10:03:30 2021 +0000
@@ -1,12 +1,12 @@
#include "MFS.h"
MFS::MFS(void)
- {
+ {
HAL_Init();
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
- __HAL_RCC_GPIOH_CLK_ENABLE();
+ //__HAL_RCC_GPIOH_CLK_ENABLE(); //F103
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_USART1_CLK_ENABLE();
@@ -25,7 +25,8 @@
GPIO_InitStruct.Pin = latch_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+
HAL_GPIO_Init(latch_GPIO_Port, &GPIO_InitStruct);
@@ -37,8 +38,11 @@
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF7_USART1;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //F103
+
+ #ifndef __STM32F1xx_HAL_H
+ GPIO_InitStruct.Alternate = GPIO_AF7_USART1; //F103
+ #endif
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
husart1.Instance = USART1;
--- a/MFS.h Fri Mar 12 08:36:07 2021 +0000
+++ b/MFS.h Fri Mar 12 10:03:30 2021 +0000
@@ -1,4 +1,4 @@
-//#include "stm32l1xx_hal.h"
+//#include "stm32f4xx_hal.h"
#include "mbed.h"
#define USART_TX_Pin GPIO_PIN_2
@@ -10,6 +10,14 @@
#define latch_Pin GPIO_PIN_5
#define latch_GPIO_Port GPIOB
+#ifndef GPIO_SPEED_FREQ_VERY_HIGH
+#define GPIO_SPEED_FREQ_VERY_HIGH GPIO_SPEED_FREQ_HIGH
+#endif
+
+#ifndef GPIO_AF7_USART1
+#define GPIO_AF7_USART1 1
+#endif
+
class MFS
{
private: