ST / ST_I2S

Dependents:   temp X_NUCLEO_CCA01M1 X_NUCLEO_CCA01M1 X_NUCLEO_CCA02M1

Platform compatibility

This driver has been designed to support a wide range of the Nucleo F4 Family of platforms and MCUs, but not all members of this family support I2S and/or some of the members might require slight modifications to the sources of this driver in order to make it work on those.

This driver has for now been tested only with the following platforms:

Revision:
17:7a4a4631672c
Parent:
16:04e1abb4cca3
Child:
19:ef6ef1795e30
diff -r 04e1abb4cca3 -r 7a4a4631672c drivers/I2S.cpp
--- a/drivers/I2S.cpp	Wed Jan 25 13:56:15 2017 +0100
+++ b/drivers/I2S.cpp	Thu Jan 26 10:37:27 2017 +0100
@@ -4,8 +4,6 @@
 
 #if DEVICE_I2S
 
-namespace mbed {
-
 I2S* I2S::_owner = NULL;
 SingletonPtr<PlatformMutex> I2S::_mutex; // intentional class level lock!
 
@@ -187,10 +185,10 @@
     return  0;
 }
 
-int I2S::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, const event_callback_t& callback, int event)
+int I2S::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, const mbed::event_callback_t& callback, int event)
 { // betzw: MUST be called with lock held!
 #if TRANSACTION_QUEUE_SIZE_I2S
-    transaction_t t;
+    mbed::transaction_t t;
 
     t.tx_buffer = const_cast<void *>(tx_buffer);
     t.tx_length = tx_length;
@@ -199,7 +197,7 @@
     t.event = event;
     t.callback = callback;
     t.width = 16;
-    Transaction<I2S> transaction(this, t);
+    mbed::Transaction<I2S> transaction(this, t);
     core_util_critical_section_enter();
     if (_transaction_buffer.full()) {
 	core_util_critical_section_enter();
@@ -227,7 +225,7 @@
 }
 
 void I2S::start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, 
-			 const event_callback_t& callback, int event)
+			 const mbed::event_callback_t& callback, int event)
 { // betzw: MUST be called with lock held!
     acquire();
     _callback = callback;
@@ -242,7 +240,7 @@
 
 #if TRANSACTION_QUEUE_SIZE_I2S
 
-void I2S::start_transaction(transaction_t *data)
+void I2S::start_transaction(mbed::transaction_t *data)
 { // betzw: MUST be called with lock held!
     start_transfer(data->tx_buffer, data->tx_length, data->rx_buffer, data->rx_length, data->callback, data->event);
 }
@@ -251,10 +249,10 @@
 {
     lock();
     if (!i2s_active(&_i2s)) {
-	Transaction<I2S> t;
+	mbed::Transaction<I2S> t;
 	if (_transaction_buffer.pop(t)) {
 	    I2S* obj = t.get_object();
-	    transaction_t* data = t.get_transaction();
+	    mbed::transaction_t* data = t.get_transaction();
 	    MBED_ASSERT(obj == this);
 	    obj->start_transaction(data);
 	}
@@ -272,7 +270,7 @@
     }
 #if TRANSACTION_QUEUE_SIZE_I2S
     if (event & I2S_EVENT_INTERNAL_TRANSFER_COMPLETE) {
-	I2sBhHandler::i2s_defer_function(Callback<void()>(this, &I2S::dequeue_transaction));
+	I2sBhHandler::i2s_defer_function(mbed::Callback<void()>(this, &I2S::dequeue_transaction));
     }
 #endif
 }
@@ -285,11 +283,9 @@
     }
 #if TRANSACTION_QUEUE_SIZE_I2S
     if (event & I2S_EVENT_INTERNAL_TRANSFER_COMPLETE) {
-	I2sBhHandler::i2s_defer_function(Callback<void()>(this, &I2S::dequeue_transaction));
+	I2sBhHandler::i2s_defer_function(mbed::Callback<void()>(this, &I2S::dequeue_transaction));
     }
 #endif
 }
 
-} // namespace mbed
-
-#endif
+#endif // DEVICE_I2S