STMicroelectronics' implementation of an I2S driver, also including DMA support.

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:
19:ef6ef1795e30
Parent:
17:7a4a4631672c
Child:
22:e04af8667cad
--- a/drivers/I2S.cpp	Fri Jan 27 08:25:10 2017 +0100
+++ b/drivers/I2S.cpp	Fri Jan 27 08:35:23 2017 +0100
@@ -73,7 +73,7 @@
     return 0;
 }
 
-int I2S::set_protocol(i2s_bitorder_t protocol) {
+int I2S::protocol(i2s_bitorder_t protocol) {
     lock();
     if (i2s_active(&_i2s)) {
 	unlock();
@@ -86,7 +86,7 @@
     return 0;
 }
 
-int I2S::set_mode(i2s_mode_t mode, bool circular) {
+int I2S::mode(i2s_mode_t mode, bool circular) {
     lock();
     if (i2s_active(&_i2s)) {
 	unlock();
@@ -186,7 +186,7 @@
 }
 
 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!
+{ // NOTE: MUST be called with lock held!
 #if TRANSACTION_QUEUE_SIZE_I2S
     mbed::transaction_t t;
 
@@ -214,7 +214,7 @@
 
 
 // ignore the fact that there are multiple physical i2s's, and always update if it wasn't us last
-void I2S::acquire() { // betzw: MUST be called with lock held!
+void I2S::acquire() { // NOTE: MUST be called with lock held!
     if (_owner != this) {
 	i2s_format(&_i2s, _dbits, _fbits, _polarity);
 	i2s_audio_frequency(&_i2s, _hz);
@@ -226,7 +226,7 @@
 
 void I2S::start_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!
+{ // NOTE: MUST be called with lock held!
     acquire();
     _callback = callback;
     _irq_tx.callback(&I2S::irq_handler_asynch_tx);
@@ -241,7 +241,7 @@
 #if TRANSACTION_QUEUE_SIZE_I2S
 
 void I2S::start_transaction(mbed::transaction_t *data)
-{ // betzw: MUST be called with lock held!
+{ // NOTE: MUST be called with lock held!
     start_transfer(data->tx_buffer, data->tx_length, data->rx_buffer, data->rx_length, data->callback, data->event);
 }