Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_CCA02M1 ST_Events-old mbed
Fork of HelloWorld_CCA02M1 by
Revision 0:7d07f4df31e1, committed 2017-04-21
- Comitter:
- davide.aliprandi@st.com
- Date:
- Fri Apr 21 11:30:45 2017 +0200
- Child:
- 1:373c6af58108
- Commit message:
- Added files.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/X_NUCLEO_CCA02M1.lib Fri Apr 21 11:30:45 2017 +0200 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/ST-Expansion-SW-Team/code/X_NUCLEO_CCA02M1/#c5091e8deede
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Apr 21 11:30:45 2017 +0200
@@ -0,0 +1,110 @@
+/**
+ ******************************************************************************
+ * @file main.cpp
+ * @author Davide Aliprandi, STMicroelectronics
+ * @version V1.0.0
+ * @date October 28th, 2016
+ * @brief mbed test application for the STMicroelectronics X-NUCLEO-CCA02M1
+ * MEMS Microphones Expansion Board.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* mbed specific header files. */
+#include "mbed.h"
+#include "rtos.h"
+
+
+#if DEVICE_I2S
+
+/* Expansion Board specific header files. */
+#include "XNucleoCCA02M1.h"
+
+
+/* Variables -----------------------------------------------------------------*/
+
+/* Initialization parameters. */
+XNucleoCCA02M1_init_t init =
+{
+ 16000, /* Default Sampling Frequency [Hz]. */
+ 2 /* Default number of channels. */
+};
+
+/* Thread to manage I2S peripherals. */
+static rtos::Thread i2s_bh_daemon;
+
+
+/* Functions -----------------------------------------------------------------*/
+
+/**
+ * @brief Entry point function of mbedOS.
+ * @param None
+ * @retval None
+ */
+int main(void)
+{
+ /*----- Initialization. -----*/
+
+ /* Initializing MEMS Microphones Expansion Board on the I2S1 interface. */
+ XNucleoCCA02M1 *microphones = new XNucleoCCA02M1(PB_15, PB_13);
+ if (microphones->init(&init) != COMPONENT_OK)
+ {
+ error("Initialization of the MEMS Microphones Expansion Board failed.\r\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Starting a thread to manage I2S peripherals. */
+ Callback<void()> i2s_bh_task(&I2S::i2s_bh_queue, &events::EventQueue::dispatch_forever);
+ i2s_bh_daemon.start(i2s_bh_task);
+
+ /* Enabling transmission via USB. */
+ microphones->enable_usb();
+
+ /* Printing to the console. */
+ printf("MEMS Microphones Application Example\r\n\n");
+
+
+ /*----- Recording. -----*/
+
+ /* Printing to the console. */
+ printf("--> Recording...\r\n");
+ microphones->record();
+}
+
+#else // DEVICE_I2S
+
+int main(void)
+{
+ printf("The target does not support I2S API.\r\n");
+}
+
+#endif // DEVICE_I2S
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Fri Apr 21 11:30:45 2017 +0200 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#42be5c01a7f91292d5e27124ad9584236025f6ab
