mbed library with additional peripherals for ST F401 board

Fork of mbed-src by mbed official

This mbed LIB has additional peripherals for ST F401 board

  • UART2 : PA_3 rx, PA_2 tx
  • UART3 : PC_7 rx, PC_6 tx
  • I2C2 : PB_3 SDA, PB_10 SCL
  • I2C3 : PB_4 SDA, PA_8 SCL

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Feb 18 11:15:06 2014 +0000
Parent:
93:80910ff1aebe
Child:
95:7f2fbdc5e413
Commit message:
Synchronized with git revision 10297b352c94ad27d9e0fdd7724addb3c7e8fbd9

Full URL: https://github.com/mbedmicro/mbed/commit/10297b352c94ad27d9e0fdd7724addb3c7e8fbd9/

[NUCLEO_xxx] Fix us_ticker and analog_out issues when -O3/-Otime options are used

Changed in this revision

targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogout_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c	Tue Feb 18 10:30:06 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c	Tue Feb 18 11:15:06 2014 +0000
@@ -49,9 +49,9 @@
 
 // Used to increment the slave counter
 static void tim_update_irq_handler(void) {
-    SlaveCounter++;
     if (TIM_GetITStatus(TIM_MST, TIM_IT_Update) == SET) {
         TIM_ClearITPendingBit(TIM_MST, TIM_IT_Update);
+        SlaveCounter++;
     }
 }
 
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c	Tue Feb 18 10:30:06 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c	Tue Feb 18 11:15:06 2014 +0000
@@ -49,9 +49,9 @@
 
 // Used to increment the slave counter
 static void tim_update_irq_handler(void) {
-    SlaveCounter++;
     if (TIM_GetITStatus(TIM_MST, TIM_IT_Update) == SET) {
         TIM_ClearITPendingBit(TIM_MST, TIM_IT_Update);
+        SlaveCounter++;
     }
 }
 
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c	Tue Feb 18 10:30:06 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c	Tue Feb 18 11:15:06 2014 +0000
@@ -52,10 +52,10 @@
 
 // Used to increment the slave counter
 static void tim_update_irq_handler(void) {
-    SlaveCounter++;
     if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_UPDATE) == SET) {
         __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_UPDATE);
         __HAL_TIM_SetCounter(&TimMasterHandle, 0); // Reset counter !!!
+        SlaveCounter++;
     }
 }
 
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogout_api.c	Tue Feb 18 10:30:06 2014 +0000
+++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/analogout_api.c	Tue Feb 18 11:15:06 2014 +0000
@@ -65,14 +65,14 @@
     DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
     DAC_InitStructure.DAC_OutputBuffer   = DAC_OutputBuffer_Disable;
     
-    if (pin == PA_4) {
+    if (obj->channel == PA_4) {
       DAC_Init(DAC_Channel_1, &DAC_InitStructure);
       DAC_Cmd(DAC_Channel_1, ENABLE);
     }
-    else { // PA_5
-      DAC_Init(DAC_Channel_2, &DAC_InitStructure);
-      DAC_Cmd(DAC_Channel_2, ENABLE);
-    }
+    //if (obj->channel == PA_5) {
+    //  DAC_Init(DAC_Channel_2, &DAC_InitStructure);
+    //  DAC_Cmd(DAC_Channel_2, ENABLE);
+    //}
               
     analogout_write_u16(obj, 0);
 }
@@ -84,18 +84,19 @@
     if (obj->channel == PA_4) {
       DAC_SetChannel1Data(DAC_Align_12b_R, value);
     }
-    else { // PA_5
-      DAC_SetChannel2Data(DAC_Align_12b_R, value);
-    }
+    //if (obj->channel == PA_5) {
+    //  DAC_SetChannel2Data(DAC_Align_12b_R, value);
+    //}
 }
 
 static inline int dac_read(dac_t *obj) {
     if (obj->channel == PA_4) {
       return (int)DAC_GetDataOutputValue(DAC_Channel_1);
     }
-    else { // PA_5
-      return (int)DAC_GetDataOutputValue(DAC_Channel_2);
-    }
+    //if (obj->channel == PA_5) {
+    //  return (int)DAC_GetDataOutputValue(DAC_Channel_2);
+    //}
+    return 0;
 }
 
 void analogout_write(dac_t *obj, float value) {