programme premier cours

Dependencies:   mbed USBDevice

Files at this revision

API Documentation at this revision

Comitter:
kanope_benny
Date:
Thu Sep 17 12:51:11 2020 +0000
Parent:
7:78af4df7012f
Commit message:
met3 origine

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 78af4df7012f -r c6ec6b9f6a55 USBDevice.lib
--- a/USBDevice.lib	Fri Mar 01 13:25:02 2013 +0000
+++ b/USBDevice.lib	Thu Sep 17 12:51:11 2020 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/USBDevice/#335f2506f422
+http://mbed.org/users/mbed_official/code/USBDevice/#53949e6131f6
diff -r 78af4df7012f -r c6ec6b9f6a55 main.cpp
--- a/main.cpp	Fri Mar 01 13:25:02 2013 +0000
+++ b/main.cpp	Thu Sep 17 12:51:11 2020 +0000
@@ -1,17 +1,115 @@
 // Hello World example for the USBMIDI library
+#if 1 
+
+ 
+#include "mbed.h"
+#include "USBSerial.h"
+
+
+void setup(void)
+{
+    RCC_ClkInitTypeDef RCC_ClkInitStruct;
+    RCC_OscInitTypeDef RCC_OscInitStruct;
+ 
+    RCC_OscInitStruct.OscillatorType =  RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
+    RCC_OscInitStruct.HSEState =        RCC_HSE_ON;
+    
+    RCC_OscInitStruct.LSIState =        RCC_LSI_ON;
+    RCC_OscInitStruct.PLL.PLLState =    RCC_PLL_ON;
+    RCC_OscInitStruct.PLL.PLLSource =   RCC_PLLSOURCE_HSE;
+    
+RCC_OscInitStruct.PLL.PLLM            = 25;             // VCO input clock = 1 MHz (25 MHz / 25)
+RCC_OscInitStruct.PLL.PLLN            = 192;           // VCO output clock = 192 MHz (1 MHz * 192)
+RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV2; // PLLCLK = 96 MHz (192 MHz / 2)
+RCC_OscInitStruct.PLL.PLLQ            = 4;             // USB clock = 48 MHz (192 MHz / 4) --> Good for USB
+  
+  HAL_RCC_OscConfig(&RCC_OscInitStruct);
+ 
+    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;
+    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
+    HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
+    
+    SystemCoreClockUpdate();
+    SystemCoreClock = 96000000;
+    
+    //HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1);        // output SYSCLOCK to pin PC9 to monitor frequency
+}
+
+ 
+
+DigitalOut myled(PC_13);
+
+int main() {    
+
+    setup();
+
+    USBSerial pc;
+         
+         
+    while (1) {    
+       pc.printf("\ncalisse de guidoune!");
+       myled = !myled; // LED 
+        wait_ms( 100 ); 
+    }
+} 
+
+
+#endif 
+
+#if 0 
 
 #include "mbed.h"
 #include "USBMIDI.h"
 
-USBMIDI midi;
 
-int main() {             
+void setup(void)
+{
+    RCC_ClkInitTypeDef RCC_ClkInitStruct;
+    RCC_OscInitTypeDef RCC_OscInitStruct;
+ 
+    RCC_OscInitStruct.OscillatorType =  RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
+    RCC_OscInitStruct.HSEState =        RCC_HSE_ON;
+    
+    RCC_OscInitStruct.LSIState =        RCC_LSI_ON;
+    RCC_OscInitStruct.PLL.PLLState =    RCC_PLL_ON;
+    RCC_OscInitStruct.PLL.PLLSource =   RCC_PLLSOURCE_HSE;
+    
+RCC_OscInitStruct.PLL.PLLM            = 25;             // VCO input clock = 1 MHz (25 MHz / 25)
+RCC_OscInitStruct.PLL.PLLN            = 192;           // VCO output clock = 192 MHz (1 MHz * 192)
+RCC_OscInitStruct.PLL.PLLP            = RCC_PLLP_DIV2; // PLLCLK = 96 MHz (192 MHz / 2)
+RCC_OscInitStruct.PLL.PLLQ            = 4;             // USB clock = 48 MHz (192 MHz / 4) --> Good for USB
+  
+  HAL_RCC_OscConfig(&RCC_OscInitStruct);
+ 
+    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;
+    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
+    HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
+    
+    SystemCoreClockUpdate();
+    SystemCoreClock = 96000000;
+    
+    //HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1);        // output SYSCLOCK to pin PC9 to monitor frequency
+}
+
+ 
+
+int main() {    
+
+    setup();
+
+    USBMIDI midi;
+    
+         
     while (1) {    
         for(int i=48; i<83; i++) {     // send some messages!
             midi.write(MIDIMessage::NoteOn(i));
             wait(0.25);
             midi.write(MIDIMessage::NoteOff(i));
             wait(0.5);
+            myled = !myled; // LED 
         }
     }
 }
+#endif 
\ No newline at end of file
diff -r 78af4df7012f -r c6ec6b9f6a55 mbed.bld
--- a/mbed.bld	Fri Mar 01 13:25:02 2013 +0000
+++ b/mbed.bld	Thu Sep 17 12:51:11 2020 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/3d0ef94e36ec
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file