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: Nucleo_spi_master_20MHz Nucleo_vs_Arduino_Speed_Test DMA_I2S_Test MPU9150AHRS ... more
Revision 5:f44655076466, committed 2014-03-08
- Comitter:
- dreschpe
- Date:
- Sat Mar 08 15:03:38 2014 +0000
- Parent:
- 4:0834e0e36a1e
- Child:
- 6:b9343c8b85ec
- Commit message:
- - change from function to c++ object to ensure early startup ; - add docu
Changed in this revision
| ST_F401_84MHZ.cpp | Show annotated file Show diff for this revision Revisions of this file |
| ST_F401_84MHZ.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ST_F401_84MHZ.cpp Fri Mar 07 21:23:07 2014 +0000
+++ b/ST_F401_84MHZ.cpp Sat Mar 08 15:03:38 2014 +0000
@@ -3,8 +3,18 @@
//
#include "stm32f4xx_hal.h"
+#include "ST_F401_84MHZ.h"
-void SystemClock_Config_84MHz_internal(void)
+F401_init84::F401_init84(unsigned int external){
+ if(external == 1){
+ SystemClock_Config_84MHz_external();
+ }
+ else {
+ SystemClock_Config_84MHz_internal();
+ }
+ }
+
+void F401_init84::SystemClock_Config_84MHz_internal(void)
{
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
@@ -34,7 +44,7 @@
// R35,R37 0R 0603 or use wire
-void SystemClock_Config_84MHz_external(void)
+void F401_init84::SystemClock_Config_84MHz_external(void)
{
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
--- a/ST_F401_84MHZ.h Fri Mar 07 21:23:07 2014 +0000
+++ b/ST_F401_84MHZ.h Sat Mar 08 15:03:38 2014 +0000
@@ -1,7 +1,44 @@
+/* mbed library for the ST NUCLEO board F401RE
+ * to change the CPU clock to 84 MHz
+ *
+ * Copyright (c) 2014 Peter Drescher - DC2PD
+ * Released under the MIT License: http://mbed.org/license/mit
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
#ifndef MBED_ST_F401_84MHZ_H
#define MBED_ST_F401_84MHZ_H
-void SystemClock_Config_84MHz_internal(void);
+/** Setup speed to 84 MHz
+ *
+ * @code
+ * #include "mbed.h"
+ * #include "ST_F401_84MHZ.h"
+ *
+ * // place the init before other code to ensure right timing of other objects !
+ * F401_init84 myinit(0); // use the internal oscillator
+ *
+ */
+
+class F401_init84
+{
+public:
+ /** Create a F401_init84 object to change the clock
+ * @param external = 0 use internal oscillator
+ * @param external = 1 use external 8 MHz crystal - you have to add some comonents to the pcb !
+*/
+F401_init84(unsigned int external);
+
+protected:
+// do the magic ;-)
+void SystemClock_Config_84MHz_internal(void);
void SystemClock_Config_84MHz_external(void);
+};
#endif
\ No newline at end of file