Il y avait des problèmes dans la libraire...

Dependents:   X_NUCLEO_CCA02M1

Fork of ST_I2S by ST

Revision:
12:7309748f058a
Parent:
10:1a612c2e4a85
Child:
13:fa1b24df9025
--- a/targets/TARGET_STM/stm_i2s_api.c	Thu Dec 22 14:39:28 2016 +0100
+++ b/targets/TARGET_STM/stm_i2s_api.c	Thu Dec 22 15:00:34 2016 +0100
@@ -896,6 +896,7 @@
     return f;
 }
 
+// betzw - QUESTION: seems to resolve only the case of multiples of 2!?!
 int8_t i2s_harmonize(i2s_t *dev_i2s_1, uint32_t *freq_i2s_1, i2s_t *dev_i2s_2, uint32_t *freq_i2s_2)
 {
     /* Compute the real frequencies. */
@@ -917,14 +918,16 @@
         q = f2 / f1;
     else
         q = f1 / f2;
-    float r = q - (uint32_t) q;
-
+    float r = q - (uint32_t) q; /* betzw - TODO: call libc functions to get a guarantee 
+				   for actually desired behavior */
+						 
     if (r > 0)
     {
         if (f1 < f2)
         {
             float mf = i2s_compute_magic_factor(dev_i2s_1, f2 / 2);
-            r = mf - (uint32_t) mf;
+            r = mf - (uint32_t) mf; /* betzw - TODO: call libc functions to get a guarantee 
+				       for actually desired behavior */
             if (r > 0)
             {
                 if (f2 > *freq_i2s_2)
@@ -939,7 +942,8 @@
         else
         {
             float mf = i2s_compute_magic_factor(dev_i2s_2, f1 / 2);
-            r = mf - (uint32_t) mf;
+            r = mf - (uint32_t) mf; /* betzw - TODO: call libc functions to get a guarantee 
+				       for actually desired behavior */
             if (r > 0)
             {
                 if (f1 > *freq_i2s_1)
@@ -951,6 +955,8 @@
             else
                 f2 = f1 / 2;
         }
+    } else { // betzw - QUESTION for Davide!
+	return -1;
     }
 
     //printf("DESIRED: %f %f\r\n", f1, f2);